Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created May 5, 2012 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreymcmahon/2600218 to your computer and use it in GitHub Desktop.
Save coreymcmahon/2600218 to your computer and use it in GitHub Desktop.
Using the Form class in a Controller - http://www.symfonycentral.com
<?php
use MyCompany\BlogBundle\Form\Type\ArticleType;
use MyCompany\BlogBundle\Entity\Article;
/* ... rest of the controller */
/**
* @Route("/article/add", name="post_add")
* @Template()
*/
public function addAction()
{
$article = new Article();
$form = $this->createForm(new ArticleType(), $article);
/* ... rest of the controller */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment