Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created May 7, 2012 13:24
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/2627734 to your computer and use it in GitHub Desktop.
Save coreymcmahon/2627734 to your computer and use it in GitHub Desktop.
A UserType class used to implement a form for the User entity - http://www.symfonycentral.com/symfony-does-validation.html
<?php
namespace MyCompany\BlogBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
class UserType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('username')
->add('email')
->add('password', 'password')
;
}
public function getName()
{
return 'mycompany_blogbundle_usertype';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment