3 namespace Rapsys\AirBundle\Form
; 
   5 use Symfony\Component\Form\AbstractType
; 
   6 use Symfony\Component\Form\FormBuilderInterface
; 
   7 use Symfony\Component\OptionsResolver\OptionsResolver
; 
   8 use Symfony\Bridge\Doctrine\Form\Type\EntityType
; 
   9 use Symfony\Component\Form\Extension\Core\Type\DateType
; 
  10 use Symfony\Component\Form\Extension\Core\Type\SubmitType
; 
  11 use Symfony\Component\Validator\Constraints\Date
; 
  12 use Symfony\Component\Validator\Constraints\NotBlank
; 
  14 class ApplicationType 
extends AbstractType 
{ 
  18         public function buildForm(FormBuilderInterface 
$builder, array $options) { 
  20                         ->add('location', EntityType
::class, array('class' => 'RapsysAirBundle:Location', 'choice_label' => 'title', 'attr' => array('placeholder' => 'Your location'), 'constraints' => array(new NotBlank(array('message' => 'Please provide your location'))))) 
  21                         ->add('date', DateType
::class, array('attr' => [ 'placeholder' => 'Your date', 'class' => 'date' ], 'html5' => true, 'input' => 'datetime', 'data' => new \
DateTime('+7 day'), 'constraints' => array(new NotBlank(array('message' => 'Please provide your date')), new Date(array('message' => 'Your date doesn\'t seems to be valid'))))) 
  22                         ->add('slot', EntityType
::class, array('class' => 'RapsysAirBundle:Slot', 'choice_label' => 'title', 'attr' => array('placeholder' => 'Your slot'), 'constraints' => array(new NotBlank(array('message' => 'Please provide your slot'))))) 
  23                         ->add('submit', SubmitType
::class, array('label' => 'Send', 'attr' => array('class' => 'submit'))); 
  29         public function configureOptions(OptionsResolver 
$resolver) { 
  30                 $resolver->setDefaults(['error_bubbling' => true]); 
  36         public function getName() { 
  37                 return 'rapsys_air_application';