OffreLegumesInsertType.php 1.37 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
<?php

namespace PotageBundle\Form\Offre;

use PotageBundle\Entity\Offre;
use PotageBundle\Entity\OffreLegumes;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class OffreLegumesInsertType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('offre', EntityType::class, array(
            'class' => Offre::class,
            'label' => 'Offres en préparation',
            'attr' => array(
                'class' => 'form-control form-control-sm'
            ),
            'choice_label' => 'getReference'
        ));
        
        $builder->add('sauver', SubmitType::class, array(
            'label' => 'Enregistrer',
            'attr' => array('class' => 'btn btn-dark mb-2')
        ));
    }
    
    public function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);
        $resolver->setDefault('data_class', OffreLegumes::class);
        $resolver->setDefault('attr', array(
            'class' => 'formulaire formulaire_offre_legumes_insert',
        ));
    }
    
    public function getBlockPrefix()
    {
        return 'offre_legumes_insert_type';
    }
}