Skip to content

Instantly share code, notes, and snippets.

@ecoleman
Created June 3, 2012 00:51
Show Gist options
  • Save ecoleman/2860764 to your computer and use it in GitHub Desktop.
Save ecoleman/2860764 to your computer and use it in GitHub Desktop.
<?php
namespace My\UserBundle\Form;
use My\ContactBundle\Form\BasicPersonType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class UserType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('username')
->add('email')
->add('person', new BasicPersonType())
->add('plainPassword', 'repeated', [
'type' => 'password',
'invalid_message' => 'The password fields must match',
'options' => [
'required' => false,
],
'first_options' => ['label' => 'Password', 'required' => false],
'second_options' => ['label' => 'Confirm Password', 'required' => false]
]);
;
}
public function getDefaultOptions()
{
return [
'data_class' => 'My\UserBundle\Entity\User'
];
}
public function getName()
{
return 'my_userbundle_usertype';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment