/** * Deletes a tower * * @param string $id */ public function deleteAction($id) { $tower = Tower::findFirstByid($id); if (!$tower) { $this->flash->error("tower was not found"); return $this->dispatcher->forward(array("controller" => "tower", "action" => "index")); } if (!$tower->delete()) { foreach ($tower->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "tower", "action" => "search")); } $this->flash->success("tower was deleted successfully"); return $this->dispatcher->forward(array("controller" => "tower", "action" => "index")); }