/** * Creates a new tower */ public function createAction() { if (!$this->request->isPost()) { return $this->dispatcher->forward(array("controller" => "tower", "action" => "index")); } $tower = new Tower(); $tower->setId($this->request->getPost("id")); $tower->setCompanyid($this->request->getPost("companyid")); $tower->setNumber($this->request->getPost("number")); if (!$tower->save()) { foreach ($tower->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "tower", "action" => "new")); } $this->flash->success("tower was created successfully"); return $this->dispatcher->forward(array("controller" => "tower", "action" => "index")); }