hasMany('Order', array('customer_id' => 'id')); } /** * @param ActiveQuery $query * @return ActiveQuery */ public function active($query) { return $query->andWhere(array('status' => self::STATUS_ACTIVE)); } }