public function afterFind() { $this->id_cor = Cor::findOne($this->id_cor)->nome; $this->id_tipo_combustivel = TipoCombustivel::findOne($this->id_tipo_combustivel)->nome; $this->id_modelo = Modelo::findOne($this->id_modelo)->nome; switch ($this->status) { case '1': $this->status = 'Leiloado'; break; case '2': $this->status = 'Disponível'; break; case '3': $this->status = 'Alocado'; break; } }
/** * Finds the Modelo model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Modelo the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Modelo::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }