public function addPhoneNumberAction() { // cria form if ($this->getRequest()->isPost()) { $postData = $this->getRequest()->getPost(); $form = new C3op_Form_PhoneNumberCreate(); $this->view->form = $form; if ($form->isValid($postData)) { $id = $form->process($postData); $this->_helper->getHelper('FlashMessenger')->addMessage('The record was successfully updated.'); $this->_redirect('/register/contact/success-create/?id=' . $id); } else { throw new C3op_Register_ContactException("Invalid data for phone number."); } } else { $contactId = $this->checkIdFromGet(); $contactHasPhone = $this->contactMapper->findById($contactId); $data = $this->_request->getParams(); $form = new C3op_Form_PhoneNumberCreate(); C3op_Util_FormFieldValueSetter::SetValueToFormField($form, 'contact', $contactId); $this->view->form = $form; $contactInfo = array('id' => $contactId, 'name' => $contactHasPhone->GetName()); $this->view->contactInfo = $contactInfo; } }