예제 #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCity()
 {
     return $this->hasOne(City::className(), ['id' => 'city_id']);
 }
예제 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCities()
 {
     return $this->hasMany(City::className(), ['province_id' => 'id'])->andFilterWhere(['like', 'status', City::STATUS_ACTIVE]);
 }
예제 #3
0
 /**
  * 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]);
 }
예제 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCities()
 {
     return $this->hasMany(City::className(), ['province_id' => 'id'])->andFilterWhere(['like', 'recordStatus', City::RECORDSTATUS_USED]);
 }