Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public function addAction() {
$form = new \Zebreco\Form\Contact();
if ($this->getRequest()->isPost()) {
$service = $this->getServiceLocator()->get('Zebreco\Service\Contact');
if ($form->isValid()) {
$contact = $service->create($form->getData());
if ($contact) {
$this->flashMessenger()->addMessage(array('success' => 'Contact was created successfully.'));
return $this->redirect()->toRoute('zebreco/admin/contact', array(
'action' => 'view',
'id' => $contact->getContactid())
$this->flashMessenger()->addMessage(array('error' => 'Unable to create contact.'));
return array('form' => $form);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment