public function addAction() { $form = new StudentForm(); $form->get('submit')->setValue('Add'); $request = $this->getRequest(); if ($request->isPost()) { $student = new Student(); $form->setInputFilter($student->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $student->exchangeArray($form->getData()); $this->getEntityManager()->persist($student); $this->getEntityManager()->flush(); // Redirect to list of albums return $this->redirect()->toRoute('student'); } } return array('form' => $form); }
/** * {@inheritDoc} */ public function getInputFilter() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getInputFilter', array()); return parent::getInputFilter(); }