/** * Deletes a accessLine * * @param string $id */ public function deleteAction() { try { if (!$this->request->isPost()) { throw new Exception('Acesso não permitido a essa action.'); } if ($this->request->isAjax()) { $this->view->disable(); } $id = $this->request->getPost('id'); $accessLine = AccessLine::findFirstByid($id); if (!$accessLine) { throw new Exception('Acesso a Linha não encontrada!'); } if (!$accessLine->delete()) { $msg = ''; foreach ($accessLine->getMessages() as $message) { $msg .= $message . '<br />'; } throw new Exception($msg); } echo 'ok'; } catch (Exception $exc) { $this->flash->error($exc->getMessage()); return $this->response->redirect('telephony/access_line'); } }