/** * Creates a new tipocarga */ public function createAction() { if (!$this->request->isPost()) { return $this->dispatcher->forward(array("controller" => "tipocarga", "action" => "index")); } $tipocarga = new Tipocarga(); $tipocarga->setTipocargaNombre($this->request->getPost("tipoCarga_nombre")); $tipocarga->setTipocargaHabilitado(1); if (!$tipocarga->save()) { foreach ($tipocarga->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "tipocarga", "action" => "new")); } $this->flash->success("El tipo de Carga ha sido creado correctamente"); return $this->dispatcher->forward(array("controller" => "tipocarga", "action" => "index")); }