/** * Creates a new vehiculo */ public function createAction() { if (!$this->request->isPost()) { return $this->dispatcher->forward(array("controller" => "vehiculo", "action" => "index")); } $vehiculo = new Vehiculo(); $vehiculo->idtipos_vehiculo = $this->request->getPost("idtipos_vehiculo"); $vehiculo->placa = $this->request->getPost("placa"); if (!$vehiculo->save()) { foreach ($vehiculo->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "vehiculo", "action" => "new")); } $this->flash->success("vehiculo was created successfully"); return $this->dispatcher->forward(array("controller" => "vehiculo", "action" => "index")); }