<?php
/**
 * @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
 * @date 02/16/2017
 */

namespace AppBundle\Form;


use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class SearchRequestType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->setMethod('GET');
        $builder
            ->add('b', StDateType::class, [
                'required' => false,
                //'data' => new \DateTime('+5 day'),
            ])
            ->add('e', StDateType::class, [
                'required' => false,
                //'data' => new \DateTime('+19 day'),
            ])
            ->add('c', EntityType::class, [
                'required' => false,
                'placeholder' => 'beliebiges Reiseziel',
                'class' => 'AppBundle\Entity\TravelCountry',
            ])
            ->add('c2', EntityType::class, [
                'required' => false,
                'placeholder' => 'Bitte wählen (optional)',
                'class' => 'AppBundle\Entity\TravelCountry',
            ])
            ;
    }

    /**
     * @param OptionsResolver $resolver
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'csrf_protection' => false,
        ));
    }

    public function getBlockPrefix()
    {
        return null;
    }
}