Created
February 24, 2011 23:12
-
-
Save webmozart/843094 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
| protected function editAction(Post $post) | |
| { | |
| $factory = new HelloFormFactory($this->get('form.factory')); | |
| $form = $factory->getPostForm($post); | |
| if ($this->get('request')->getMethod() === 'POST') { | |
| $form->bindRequest($this->get('request')); | |
| if ($form->isValid()) { | |
| $em = $this->get('doctrine.orm.default_entity_manager'); | |
| $em->persist($post); | |
| $em->flush(); | |
| return new RedirectResponse($this->generateUrl('hello_index')); | |
| } | |
| } | |
| return $this->render('HelloBundle:Hello:edit.html.twig', array( | |
| 'form' => $form->getRenderer(), | |
| )); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment