Skip to content

Instantly share code, notes, and snippets.

@AdrianSchneider
Created November 8, 2012 20:09
Show Gist options
  • Save AdrianSchneider/4041210 to your computer and use it in GitHub Desktop.
Save AdrianSchneider/4041210 to your computer and use it in GitHub Desktop.
public function editAction(Person $person, Request $request)
{
$form = $this->formFactory->create('person_edit', $person);
if ($request->getMethod() == 'POST') {
$form->bind($request);
if ($form->isValid()) {
$this->manager->update($person);
$this->flashes->add('success', 'Profile updated successfully.');
return new RedirectResponse($this->urlGenerator->generate(
'people_view',
array('id' => $person->getId())
));
}
}
return new Response(
$this->templating->render('BundleName:People:edit.html.twig', array(
'form' => $form->createView(),
'person' => $person
))
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment