/** * Creates a new accessLine */ public function createAction() { try { if (!$this->request->isPost()) { throw new Exception('Acesso não permitido a essa action.'); } $accessLine = new AccessLine(); $accessLine->setId($accessLine->autoincrement()); $accessLine->setCpf($this->request->getPost('cpf', 'alphanum')); $accessLine->setLinha($this->request->getPost('linha')); if (!$accessLine->create()) { $msg = ''; foreach ($accessLine->getMessages() as $message) { $msg .= $message . '<br />'; } throw new Exception($msg); } $this->flash->success('Acesso a Linha gravada com sucesso!!!'); } catch (Exception $exc) { $this->flash->error($exc->getMessage()); } return $this->response->redirect('telephony/access_line'); }