hasMany(Order::className(), ['customer_id' => 'id']); } public static function active($query) { $query->andWhere(['status' => 1]); } public static function getRecordSchema() { return new RecordSchema(array( 'name' => 'customer', 'primaryKey' => array('id'), 'columns' => array( 'id' => 'integer', 'email' => 'string', 'name' => 'string', 'address' => 'string', 'status' => 'integer' ) )); } }