<?php

namespace App\Form;

use App\Entity\EventPerformer;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class EventPerformerType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder->add('name', TextType::class, [ 'required' => true, 'attr' => ['maxlength' => 150] ])
            ->add('ordre', NumberType::class, [ 'required' => true ])
            ->add('deleted', HiddenType::class);
        }

    public function configureOptions(OptionsResolver $resolver): void
    {
        $resolver->setDefaults([
            'data_class' => EventPerformer::class,
            "allow_extra_fields" => true
        ]);
    }
}
