array( 'link' => array('customer_id' => 'id'), ), ); } public static function scopes() { $status = self::STATUS_ACTIVE; return array( 'active' => function($q) use ($status){ return $q->andWhere('@.`status` = ' . $status); }, ); } }