Last active
December 28, 2015 19:29
-
-
Save gpfiel/7550867 to your computer and use it in GitHub Desktop.
Loop
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 editAction() | |
{ | |
$album = new Album; | |
if ($this->params('id') > 0) | |
$album = $this->getEntityManager()->getRepository('Admin\Entity\Album')->find($this->params('id')); | |
$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()); | |
if ($form->isValid()) { | |
$em = $this->getEntityManager(); | |
$em->persist($album); | |
$em->flush(); // here the systems loop | |
echo '<pre>'; | |
print_r('entrou'); | |
exit; | |
// return $this->redirect()->toRoute('album'); | |
} | |
} | |
$form->get('date')->setValue(self::formatDate($form->get('date')->getValue())); | |
return new ViewModel(array( | |
'album' => $album, | |
'form' => $form | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment