Customer.php 573 Bytes
Newer Older
Qiang Xue committed
1 2
<?php
namespace yiiunit\data\ar;
Alexander Makarov committed
3

4 5 6 7 8 9 10 11 12
/**
 * Class Customer
 *
 * @property integer $id
 * @property string $name
 * @property string $email
 * @property string $address
 * @property integer $status
 */
Qiang Xue committed
13 14
class Customer extends ActiveRecord
{
Qiang Xue committed
15 16 17
	const STATUS_ACTIVE = 1;
	const STATUS_INACTIVE = 2;

Qiang Xue committed
18 19
	public $status2;

Qiang Xue committed
20
	public static function tableName()
Qiang Xue committed
21 22 23
	{
		return 'tbl_customer';
	}
Qiang Xue committed
24

Qiang Xue committed
25
	public function getOrders()
Qiang Xue committed
26
	{
Qiang Xue committed
27
		return $this->hasMany('Order', array('customer_id' => 'id'))->orderBy('id');
Qiang Xue committed
28
	}
29 30 31

	public static function active($query)
	{
Qiang Xue committed
32
		$query->andWhere('status=1');
33
	}
Zander Baldwin committed
34
}