コード例 #1
0
ファイル: CartSearch.php プロジェクト: andreosoft/andreocms
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Cart::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'cart_customer_id' => $this->cart_customer_id, 'createdby' => $this->createdby, 'createdon' => $this->createdon, 'editedby' => $this->editedby, 'editedon' => $this->editedon, 'full_price' => $this->full_price, 'delivery_price' => $this->delivery_price, 'products_price' => $this->products_price]);
     $query->andFilterWhere(['like', 'comments', $this->comments]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * Finds the Cart model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Cart the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Cart::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }