/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PalletHasCaja::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['Pallet_idPallet' => $this->Pallet_idPallet, 'Caja_idCaja' => $this->Caja_idCaja]); $query->andFilterWhere(['like', 'descript', $this->descript]); return $dataProvider; }
/** * Finds the PalletHasCaja model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $Pallet_idPallet * @param integer $Caja_idCaja * @return PalletHasCaja the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($Pallet_idPallet, $Caja_idCaja) { if (($model = PalletHasCaja::findOne(['Pallet_idPallet' => $Pallet_idPallet, 'Caja_idCaja' => $Caja_idCaja])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getPalletHasCajas() { return $this->hasMany(PalletHasCaja::className(), ['Pallet_idPallet' => 'idPallet']); }
/** * @return \yii\db\ActiveQuery */ public function getPalletHasCajas() { return $this->hasMany(PalletHasCaja::className(), ['Caja_idCaja' => 'idCaja', 'Caja_TipoCaja_idTipoCaja' => 'TipoCaja_idTipoCaja']); }