Skip to content

Instantly share code, notes, and snippets.

@pboethig
Created July 10, 2016 11:55
Show Gist options
  • Save pboethig/b7f7938035f591a3e50b54e22fa0631e to your computer and use it in GitHub Desktop.
Save pboethig/b7f7938035f591a3e50b54e22fa0631e to your computer and use it in GitHub Desktop.
<?php
namespace BlogBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
class UsersType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('firstname')
->add('lastame')
->add('username')
->add('email', EmailType::class)
->add('password', RepeatedType::class, array(
'type' => PasswordType::class,
'first_options' => array('label' => 'Password'),
'second_options' => array('label' => 'Repeat Password')))
->add('created')
->add('updated')
->add('isdeleted')
->add('isactive')
;
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'BlogBundle\Entity\Users'
));
}
public function getBlockPrefix()
{
return 'blogbundle_users';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment