/** * @inheritdoc */ public function getRoute() { switch ($this->key) { case self::KEY_NUEVO_PEDIDO: $pedido = ProyectoPedido::findOne($this->key_id); return ['/proyecto-pedido/view', 'id' => $pedido->id]; break; case self::KEY_NUEVO_PEDIDO_ACC: $pedido = AccionCentralizadaPedido::findOne($this->key_id); return ['/accion-centralizada-pedido/view', 'id' => $this->key_id]; break; case self::KEY_PEDIDO_ACC_APROBADO: return ['/']; break; } }
/** * Finds the ProyectoPedido model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return ProyectoPedido the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ProyectoPedido::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }