Skip to content

Instantly share code, notes, and snippets.

@NicolasBadey
Last active December 31, 2015 13:49
Show Gist options
  • Save NicolasBadey/7995592 to your computer and use it in GitHub Desktop.
Save NicolasBadey/7995592 to your computer and use it in GitHub Desktop.
ex action - IIM
<?php
public function createAction(Request $request)
{
$form = $this->createForm('iim.article.form.type', null, array(
'action' => $this->generateUrl('article_create'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('label' => 'Create'));
if ('POST' == $request->getMethod()) {
$form->handleRequest($request);
if ($form->isValid()) {
$article = $form->getData();
$this->get('article.manager')->update($article);
return $this->redirect($this->generateUrl('article_show', array('id' => $article->getId())));
}
}
return array(
'form' => $form->createView()
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment