public function createAction() { if ($this->getRequest()->isPost()) { $form = new Application_Form_Imie(); if ($form->isValid($this->getRequest()->getPost())) { $data = $form->getValues(); $DbTable = new Application_Model_DbTable_Imie(); $id = $DbTable->insert($data); return $this->_helper->redirector( 'edit', 'index', null, array('id' => $id) ); } $this->view->form = $form; } else { throw new Zend_Controller_Action_Exception('Błędny adres!', 404); } }
Listing 28.7. Metoda akcji create
Rozdział 28. Przetwarzanie formularza, czyli implementacja interfejsu CRUD