/** * Finds the Empresas model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Empresas the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Empresas::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Obtener empresa * @return Empresas|null */ protected function obtenerEmpresa() { if ($this->_empresa === null) { $this->_empresa = Empresas::findOne($this->id_empresa); } return $this->_empresa; }