Ejemplo n.º 1
0
 static function find($search_id)
 {
     $found_cuisine = null;
     $cuisines = cuisine::getAll();
     foreach ($cuisines as $cuisine) {
         $cuisine_id = $cuisine->getId();
         if ($cuisine_id == $search_id) {
             $found_cuisine = $cuisine;
         }
     }
     return $found_cuisine;
 }
 public function search($params)
 {
     $query = Cuisine::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['defaultOrder' => ['Id' => SORT_ASC, 'name' => SORT_ASC]]);
     $query->andFilterWhere([cuisine::tableName() . '.status' => '0']);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'createdOn' => $this->createdOn, 'status' => $this->status, 'updatedOn' => $this->updatedOn, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'desc', $this->desc])->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'searchAlias', $this->searchAlias]);
     return $dataProvider;
 }
Ejemplo n.º 3
0
 /**
  * Finds the cuisine model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return cuisine the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = cuisine::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }