CommandeLegumesType.php 1.5 KB
Newer Older
1 2 3 4 5 6
<?php

namespace PotageBundle\Form\Membre;

use PotageBundle\Entity\CommandeLegumes;
use Symfony\Component\Form\AbstractType;
7
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
Mat's avatar
Mat committed
8
use Symfony\Component\Form\Extension\Core\Type\NumberType;
9 10 11 12 13 14 15 16
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CommandeLegumesType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
17 18 19 20 21 22 23 24 25
            /*
                ->add('prixUnitaire', MoneyType::class, array(
                    'currency' => 'EUR',
                    'disabled' => true,
                ))
                ->add('unite', TextType::class, array(
                    'disabled' => true,
                ))
            */
Mat's avatar
Mat committed
26 27
            ->add('quantite', NumberType::class, array(
                'scale' => 3,  //décimales
28
                'disabled' => true,
Mat's avatar
Mat committed
29
            ))
30
            ->add('prix', MoneyType::class, array(
Mat's avatar
Mat committed
31
                'currency' => 'EUR',
32 33
                'scale' => 2,
                'disabled' => true,
34
            ))
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
        ;
    }
    
    public function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);
        $resolver->setDefault('data_class', CommandeLegumes::class);
        $resolver->setDefault('attr', array(
            'class' => 'formulaire formulaire_commande',
        ));
    }
    
    public function getBlockPrefix()
    {
        return 'commande_legumes';
    }
}