/** * Creates a new tarifa */ public function createAction() { if (!$this->request->isPost()) { return $this->dispatcher->forward(array("controller" => "tarifa", "action" => "index")); } $tarifa = new Tarifa(); $tarifa->setTarifaHorainicial($this->request->getPost("tarifa_horaInicial")); $tarifa->setTarifaHorafinal($this->request->getPost("tarifa_horaFinal")); $tarifa->setTarifaHsservicio($this->request->getPost("tarifa_hsServicio")); $tarifa->setTarifaHshidro($this->request->getPost("tarifa_hsHidro")); $tarifa->setTarifaHsmalacate($this->request->getPost("tarifa_hsMalacate")); $tarifa->setTarifaHsstand($this->request->getPost("tarifa_hsStand")); $tarifa->setTarifaKm($this->request->getPost("tarifa_km")); if (!$tarifa->save()) { foreach ($tarifa->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "tarifa", "action" => "new")); } $this->flash->success("tarifa was created successfully"); return $this->dispatcher->forward(array("controller" => "tarifa", "action" => "index")); }