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; }
/** * @return \yii\db\ActiveQuery */ public function getInventories() { return $this->hasMany(Inventory::className(), ['store_id' => 'store_id']); }
/** * @return \yii\db\ActiveQuery */ public function getInventory() { return $this->hasOne(Inventory::className(), ['inventory_id' => 'inventory_id']); }
/** * 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.'); } }