-
-
Save fabiocarneiro/7547813 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()); | |
return array('form' => $form); | |
if ($form->isValid()) { | |
$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'); | |
} | |
} | |
} |
é um gist, o nome do arquivo pouco importa.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tá escrito errado o nome do arquivo.