示例#1
0
 public function search($params)
 {
     $query = Crowd::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy, 'createdOn' => $this->createdOn, 'updatedOn' => $this->updatedOn, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'ip', $this->ip]);
     return $dataProvider;
 }
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCrowd()
 {
     return $this->hasOne(Crowd::className(), ['Id' => 'crowdId']);
 }
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCrowd()
 {
     return $this->hasMany(Crowd::className(), ['Id' => 'crowdId'])->via('resMaps');
 }
 /**
  * Finds the Crowd model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Crowd the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Crowd::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }