/** * Action pour la création. * * @return array */ public function createAction() { $oForm = new \Commun\Form\ItemPersonnageRaidForm(); //new \Commun\Form\ItemPersonnageRaidForm($this->getServiceLocator()); $oRequest = $this->getRequest(); $oFiltre = new \Commun\Filter\ItemPersonnageRaidFilter(); $oForm->setInputFilter($oFiltre->getInputFilter()); if ($oRequest->isPost()) { $oEntite = new \Commun\Model\ItemPersonnageRaid(); $oForm->setData($oRequest->getPost()); if ($oForm->isValid()) { $oEntite->exchangeArray($oForm->getData()); $this->getTable()->insert($oEntite); $this->flashMessenger()->addMessage($this->_getServTranslator()->translate("La item-personnage-raid a été créé avec succès."), 'success'); return $this->redirect()->toRoute('backend-item-personnage-raid-list'); } } // Pour optimiser le rendu $oViewModel = new ViewModel(); $oViewModel->setTemplate('backend/item-personnage-raid/create'); return $oViewModel->setVariables(array('form' => $oForm)); }