Customer.php 433 Bytes
Newer Older
Qiang Xue committed
1 2 3
<?php

namespace yiiunit\data\ar;
Qiang Xue committed
4
use yii\db\ActiveQuery;
Qiang Xue committed
5 6 7

class Customer extends ActiveRecord
{
Qiang Xue committed
8 9 10
	const STATUS_ACTIVE = 1;
	const STATUS_INACTIVE = 2;

Qiang Xue committed
11 12
	public $status2;

Qiang Xue committed
13
	public static function tableName()
Qiang Xue committed
14 15 16
	{
		return 'tbl_customer';
	}
Qiang Xue committed
17

Qiang Xue committed
18
	public function getOrders()
Qiang Xue committed
19
	{
Qiang Xue committed
20
		return $this->hasMany('Order', array('customer_id' => 'id'))->orderBy('id');
Qiang Xue committed
21
	}
22 23 24

	public static function active($query)
	{
Qiang Xue committed
25
		$query->andWhere('status=1');
26
	}
Zander Baldwin committed
27
}