Skip to content

Instantly share code, notes, and snippets.

@gpfiel
Last active December 28, 2015 19:29
Show Gist options
  • Save gpfiel/7550867 to your computer and use it in GitHub Desktop.
Save gpfiel/7550867 to your computer and use it in GitHub Desktop.
Loop
<?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