示例#1
0
 public static function find_list()
 {
     $query['stories'] = City::find()->select('geobase_city.name,geobase_city.id')->leftJoin('t_store', 't_store.city_id=geobase_city.id')->where('t_store.id IS NOT NULL')->orderBy('geobase_city.name')->asArray()->all();
     $query['stories_all'] = City::find()->leftJoin('t_store', 't_store.city_id=geobase_city.id')->where('t_store.id IS NULL')->orderBy('geobase_city.name')->asArray()->all();
     //echo '<pre>';print_r($query['stories_all']);echo '</pre>';die;
     $query['regions'] = Region::find()->asArray()->orderBy('geobase_region.name')->all();
     return $query;
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Region::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
示例#3
0
 /**
  * Finds the Region model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Region the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Region::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#4
0
文件: City.php 项目: kd-brinex/kd
 public function all_regions()
 {
     return Region::find()->asArray()->all();
 }