Exemplo n.º 1
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('firstName', 'text', array('label' => 'First Name', 'data' => $this->existingUser->getFirstName(), 'constraints' => array(new NotBlank(), new Length(array('min' => 3)))));
     $builder->add('lastName', 'text', array('label' => 'Last Name', 'data' => $this->existingUser->getLastName(), 'constraints' => array(new NotBlank(), new Length(array('min' => 3)))));
     $builder->add('email', 'email', array('label' => 'Email', 'read_only' => true, 'data' => $this->existingUser->getEmail(), 'constraints' => array(new NotBlank(), new Email())));
     $builder->add('mobile', 'text', array('max_length' => 20, 'data' => $this->existingUser->getMobile(), 'required' => false, 'label' => 'Mobile', 'constraints' => array(new NotBlank(), new Length(array('min' => 3)), new Regex(array('pattern' => '/[0-9]/', 'message' => 'Please enter only numbers and not any other characters.')))));
 }
Exemplo n.º 2
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('firstName', 'text', array('label' => 'First Name', 'read_only' => true, 'data' => $this->existingUser->getFirstName()));
     $builder->add('lastName', 'text', array('label' => 'Last Name', 'read_only' => true, 'data' => $this->existingUser->getLastName()));
     $builder->add('email', 'email', array('label' => 'Email', 'read_only' => true, 'data' => $this->existingUser->getEmail()));
     $builder->add('password', 'text', array('label' => 'Password', 'data' => $this->password, 'constraints' => array(new NotBlank(), new Length(array('min' => 8, 'max' => 15)))));
 }
Exemplo n.º 3
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('firstName', 'text', array('label' => 'First Name', 'data' => $this->existingUser->getFirstName(), 'constraints' => array(new NotBlank(), new Length(array('min' => 3)))));
     $builder->add('lastName', 'text', array('label' => 'Last Name', 'data' => $this->existingUser->getLastName(), 'constraints' => array(new NotBlank(), new Length(array('min' => 3)))));
     $builder->add('email', 'email', array('label' => 'Email', 'data' => $this->existingUser->getEmail(), 'constraints' => array(new NotBlank(), new Email())));
     $builder->add('mobile', 'text', array('max_length' => 20, 'data' => $this->existingUser->getMobile(), 'required' => false, 'label' => 'Mobile', 'constraints' => array(new NotBlank(), new Length(array('min' => 3)), new Regex(array('pattern' => '/[0-9]/', 'message' => 'Please enter only numbers and not any other characters.')))));
     $builder->add('user_roles', 'choice', array('choices' => $this->roles, 'data' => $this->existingUser->getRoles(), 'label' => 'Roles', 'expanded' => true, 'multiple' => true, 'constraints' => new Count(array('min' => 1, 'minMessage' => 'You need to select minimum one role.'))));
     $builder->add('locked', 'choice', array('choices' => array(false => 'Not Locked', true => 'Locked'), 'data' => $this->existingUser->isLocked(), 'label' => 'Lock?', 'required' => false));
 }