/** * @return \yii\db\ActiveQuery */ public function getCity() { return $this->hasOne(City::className(), ['id' => 'city_id']); }
/** * @return \yii\db\ActiveQuery */ public function getCities() { return $this->hasMany(City::className(), ['province_id' => 'id'])->andFilterWhere(['like', 'status', City::STATUS_ACTIVE]); }
/** * Provide data for Depdrop options * @param type $selected * * @return mixed */ public function actionDepdropOptions($selected = 0) { echo \common\helpers\DepdropHelper::getOptionData(['modelClass' => City::className(), 'parents' => ['province_id' => function ($value) { return $value > 0 ? $value : ""; }], 'filter' => ['recordStatus' => City::RECORDSTATUS_USED], 'selected' => $selected]); }
/** * @return \yii\db\ActiveQuery */ public function getCities() { return $this->hasMany(City::className(), ['province_id' => 'id'])->andFilterWhere(['like', 'recordStatus', City::RECORDSTATUS_USED]); }