Beispiel #1
0
 /**
  * @inheritdoc
  */
 public function upload()
 {
     if ($this->validate()) {
         $this->url->saveAs('uploads/' . $this->url->baseName . '.' . $this->url->extension);
         $documento = new Documento();
         $documento->url = $this->url->baseName . '.' . $this->url->extension;
         $documento->nombre = $this->url->baseName;
         $documento->save(false);
         $proyecto = Proyecto::findOne($this->id_proyecto);
         $proyecto->id_Anteproyecto = $documento->id_Documento;
         $proyecto->save(false);
         return true;
     } else {
         return false;
     }
 }
 protected function findAmbito($proyecto)
 {
     $proyecto = Proyecto::findOne($proyecto);
     return $proyecto->nombreAmbito;
 }
 /**
  * Finds the Proyecto model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Proyecto the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Proyecto::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }