/**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('isVisible', 'hidden', array('required' => false, 'attr' => array('class' => 'is-visible')))->add('title', 'choice', array('choice_list' => $this->titlesLookup, 'empty_value' => '- Please Select -', 'constraints' => array(new Constraints\NotBlank(array('message' => 'Please select a title')))))->add('firstName', 'text', array('constraints' => array(new Constraints\NotBlank(array('message' => 'Please enter first name')), new Constraints\Regex(array('pattern' => '/^[-a-zA-Z0-9\\w]+$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('middleName', 'text', array('required' => false, 'constraints' => array(new Constraints\Regex(array('pattern' => '/^[ -a-zA-Z0-9\\w]*$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('lastName', 'text', array('constraints' => array(new Constraints\NotBlank(array('groups' => array('fullValidation'), 'message' => 'Please enter a last name')), new Constraints\Regex(array('pattern' => '/^[ -a-zA-Z0-9\\w]+$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('otherName', 'text', array('required' => false, 'constraints' => array(new Constraints\Regex(array('pattern' => '/^[a-zA-Z0-9\\w]*$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('birthDate', 'birthday', array('placeholder' => '--', 'constraints' => array(new Constraints\NotBlank(), new DateRange(array('min' => '-121 YEARS', 'max' => '-18 YEARS', 'maxMessage' => 'Applicant must be older than 18 years of age'))), 'attr' => array('data-provide' => 'datepicker', 'data-end-date' => date('d/m/Y'))))->add($builder->create('email', 'email', array('label' => 'Email Address', 'constraints' => array(new Constraints\NotBlank(), new Constraints\Email(array('message' => 'Please provide a valid email address')), $this->notProspectiveLandlordEmailConstraintSubscriber->getConstraint())))->addEventSubscriber($this->notApplicantEmailBridgeSubscriber))->add($builder->create('rentShare', 'money', array('label' => 'Share of Rent', 'currency' => 'GBP', 'constraints' => array($this->rentShareConstraintSubscriber->getRentShareConstraint())))->addEventSubscriber($this->rentShareConstraintSubscriber))->add('completionMethod', 'choice', array('choice_list' => $this->completionMethodLookup, 'empty_value' => '- Please Select -', 'attr' => array('class' => 'form-refresh'), 'constraints' => array(new Constraints\NotBlank())))->addEventSubscriber($options['guarantor_decorator'])->addEventSubscriber($this->notProspectiveLandlordEmailConstraintSubscriber)->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
         // Disable form validation on ajax requests by stopping all listeners listening to POST_SUBMIT with a lower weight priority than this, including the validationListener
         // Note: any listeners listening to POST_SUBMIT for AJAX requests, after this listener, are disabled as a result of this call
         if ($this->requestStack->getCurrentRequest()->isXmlHttpRequest()) {
             $event->stopPropagation();
         }
     }, 1);
 }
 /**
  * PRE_SUBMIT handler
  *
  * @param FormEvent $event
  */
 public function preSubmit(FormEvent $event)
 {
     $totalRent = $event->getData();
     $this->applicationRentShareSubscriber->setTotalRent($totalRent);
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $guarantorDecoratorBridgeSubscriber = clone $this->guarantorDecoratorBridgeSubscriber;
     $builder->add('isVisible', 'hidden', array('required' => false, 'attr' => array('class' => 'is-visible')))->add($builder->create('productId', 'choice', array('label' => 'Product', 'choice_list' => $this->productLookup, 'empty_value' => '- Please Select -', 'attr' => array('class' => 'form-refresh'), 'constraints' => array(new Constraints\NotBlank(array('message' => 'Please select a product')))))->addEventSubscriber($guarantorDecoratorBridgeSubscriber))->add('title', 'choice', array('choice_list' => $this->titlesLookup, 'empty_value' => '- Please Select -', 'constraints' => array(new Constraints\NotBlank(array('message' => 'Please select a title')))))->add('firstName', 'text', array('constraints' => array(new Constraints\NotBlank(array('message' => 'Please enter first name')), new Constraints\Regex(array('pattern' => '/^[-a-zA-Z0-9\\w]+$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('middleName', 'text', array('required' => false, 'constraints' => array(new Constraints\Regex(array('pattern' => '/^[ -a-zA-Z0-9\\w]*$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('lastName', 'text', array('constraints' => array(new Constraints\NotBlank(array('message' => 'Please enter a last name')), new Constraints\Regex(array('pattern' => '/^[ -a-zA-Z0-9\\w]+$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('otherName', 'text', array('required' => false, 'constraints' => array(new Constraints\Regex(array('pattern' => '/^[a-zA-Z0-9\\w]*$/', 'message' => 'Please enter alphanumeric characters and spaces only')))))->add('birthDate', 'birthday', array('placeholder' => '--', 'constraints' => array(new Constraints\NotBlank(), new DateRange(array('min' => '-121 YEARS', 'max' => '-18 YEARS', 'maxMessage' => 'Applicant must be older than 18 years of age'))), 'attr' => array('data-provide' => 'datepicker')))->add($builder->create('email', 'email', array('label' => 'Email Address', 'constraints' => array(new Constraints\NotBlank(), new Constraints\Email(array('message' => 'Please provide a valid email address')), $this->notProspectiveLandlordEmailConstraintSubscriber->getConstraint())))->addEventSubscriber($this->notApplicantEmailBridgeSubscriber))->add($builder->create('rentShare', 'money', array('label' => 'Share of Rent', 'currency' => 'GBP', 'constraints' => array($this->rentShareConstraintSubscriber->getRentShareConstraint())))->addEventSubscriber($this->rentShareConstraintSubscriber))->add('completionMethod', 'choice', array('choice_list' => $this->completionMethodLookup, 'empty_value' => '- Please Select -', 'attr' => array('class' => 'form-refresh'), 'constraints' => array(new Constraints\NotBlank())))->add('guarantors', 'collection', array('type' => $this->guarantorType, 'prototype_name' => '__guarantorname__', 'allow_add' => true, 'allow_delete' => true, 'error_bubbling' => false, 'cascade_validation' => true, 'options' => array('label' => false, 'guarantor_decorator' => $guarantorDecoratorBridgeSubscriber->getGuarantorDecorator())))->addEventSubscriber($this->applicationDecorateSubscriber)->addEventSubscriber($this->notProspectiveLandlordEmailConstraintSubscriber);
 }