/** * Finds the Pacote model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Pacote the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Pacote::findOne($id)) !== null) { $model->setItemProgramacaoPacote(); return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getPacoteIdpacote() { return $this->hasOne(Pacote::className(), ['idpacote' => 'pacote_idpacote']); }
/** * @return \yii\db\ActiveQuery */ public function getPacoteIdpacotes() { return $this->hasMany(Pacote::className(), ['idpacote' => 'pacote_idpacote'])->viaTable('itemprogramacao_has_pacote', ['itemProgramacao_iditemProgramacao' => 'iditemProgramacao']); }
/** * @return \yii\db\ActiveQuery */ public function getPacotes() { return $this->hasMany(Pacote::className(), ['evento_idevento' => 'idevento']); }
public function getPacote($id_usuario, $id_evento) { $id_evento = Yii::$app->request->post('evento_idevento'); return $results = Pacote::find()->where(['evento_idevento' => $id_evento, 'usuario_idusuario' => $id_usuario]); }
public function possuiPacote() { $id_evento = Yii::$app->request->post('evento_idevento'); if ($id_evento == NULL) { $id_evento = Yii::$app->request->get('id'); } $results = Pacote::find()->where(['evento_idevento' => $id_evento])->count(); return $results; }