public function add($value, array &$invalid) { $form = new Logic_Branch_Form_Generic(); $logic = new Logic_Branch(); if ($value['web_name'] == null) { $value['web_name'] = str_replace(" ", "", $value['symbol_def']); } $form->setDefaults($value); if ($form->isValidPartial($value)) { $logic->createBranch($form); } else { echo $form->getElement('branch_name')->getValue(); $invalid[] = $value; } }
public function addAction() { $logic = new Logic_Branch(); $form = new Logic_Branch_Form_Generic(); if ($this->getRequest()->isPost()) { if ($form->isCancelled($this->getRequest()->getPost())) { $this->_helper->redirector('index'); return; } if ($form->isValid($this->getRequest()->getPost())) { try { $logic->createBranch($form); $this->_helper->messenger->success(); $this->_helper->redirector('index'); return; } catch (Logic_Branch_Exception $e) { $this->_helper->messenger->error(); } } } $this->view->form = $form; }