/** * Cadastro de novo perfil */ public function novoAction() { $this->view->form = $this->formPerfil(); if ($this->getRequest()->isPost()) { $aDados = $this->getRequest()->getPost(); if ($this->view->form->isValid($aDados)) { $oPerfil = new Administrativo_Model_Perfil(); $check_perfil = Administrativo_Model_Perfil::getByAttribute('nome', $aDados['nome']); if ($check_perfil !== null) { $this->view->messages[] = array('error' => 'Perfil já cadastrado'); return; } $oPerfil->persist($aDados); $this->_helper->getHelper('FlashMessenger')->addMessage(array('notice' => 'Perfil cadastrado com sucesso.')); $this->_redirector->gotoSimple('editar', 'perfil', 'administrativo', array('id' => $oPerfil->getId())); } } }