<?php

/*

 * Developer : John D'Alto (jdalto@yahoo.com)

 * Date : 9/1/2012

 * All code (c)2012 JLS Consulting, all rights reserved

 */



namespace Dorcas\TabithaBundle\Form\Type;



use Symfony\Component\Form\AbstractType;

use Symfony\Component\Form\FormBuilder;

use Doctrine\ORM\EntityRepository;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;



class UsersType extends AbstractType

{

    public function buildForm(FormBuilder $builder, array $options)

    {	

        $builder->add('username', 'text', array('label' => 'User Name*:', 'error_bubbling' => 'true'));

 

        $builder->add('password', 'repeated', array(

    'type' => 'password',

    'invalid_message' => 'The password fields must match.',

            'error_bubbling' => 'true',

    'options' => array('label' => 'Password:')

));



        $builder->add('phone', 'text', array('label' => 'Phone:', 'error_bubbling' => 'true'));

        $builder->add('address', 'text', array('label' => 'Address:'));

        $builder->add('email', 'email', array('label' => 'Email:', 'error_bubbling' => 'true'));

        $builder->add('isActive', 'checkbox', array('label' => 'Enabled', 'required'  => true,));

        $builder->add('isAdmin', 'checkbox', array('label' => 'Admin', 'required'  => false,));

        $builder->add('first_name', 'text', array('label' => 'First Name*:', 'error_bubbling' => 'true'));

        $builder->add('last_name', 'text', array('label' => 'Last Name*:', 'error_bubbling' => 'true'));

    }

    

    public function getName()

    {

        return 'userform';

    }

    

        public function getDefaultOptions(array $options)

    {

        return array('data_class' => 'Dorcas\TabithaBundle\Entity\Users',);

    }

    

    public function setDefaultOptions(OptionsResolverInterface $resolver)

    {

    $resolver->setDefaults(array(

        'data_class' => 'Dorcas\TabithaBundle\Entity\Users',

    ));

    }

}

