Created
November 19, 2013 14:40
-
-
Save gpfiel/7546320 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function addAction() | |
{ | |
$album = new Album; | |
$form = new AlbumForm($this->getEntityManager()); | |
$form->setHydrator(new DoctrineEntity($this->getEntityManager(),'Admin\Entity\Album')); | |
$form->bind($album); | |
$request = $this->getRequest(); | |
if ($request->isPost()) { | |
$form->setInputFilter($album->getInputFilter()); | |
$form->setData($request->getPost()); | |
echo '<pre>'; | |
print_r($request->getPost()); | |
if ($form->isValid()) { | |
print_r('form válido'); | |
exit; | |
$em = $this->getEntityManager(); | |
$em->persist($album); | |
$em->flush(); | |
$this->pluginMensagem()->adicionarMensagem($this->params('action'),'ok', "O álbum <strong>{$album->title}</strong> foi adicionado."); | |
return $this->redirect()->toRoute('album'); | |
} | |
echo '<pre>'; | |
print_r('não ´vlaido'); | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment