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