コード例 #1
0
 public function search($params)
 {
     $query = Inventory::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['inventory_id' => $this->inventory_id, 'film_id' => $this->film_id, 'store_id' => $this->store_id, 'last_update' => $this->last_update]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getInventories()
 {
     return $this->hasMany(Inventory::className(), ['store_id' => 'store_id']);
 }
コード例 #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getInventory()
 {
     return $this->hasOne(Inventory::className(), ['inventory_id' => 'inventory_id']);
 }
コード例 #4
0
 /**
  * Finds the Inventory model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Inventory the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Inventory::findOne($id)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }