Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| TaskType | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| buildForm | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Form; |
| 4 | |
| 5 | use App\Entity\Task; |
| 6 | use App\Entity\User; |
| 7 | use Symfony\Component\Form\AbstractType; |
| 8 | use Symfony\Component\Form\FormBuilderInterface; |
| 9 | use Symfony\Bridge\Doctrine\Form\Type\EntityType; |
| 10 | use Symfony\Component\OptionsResolver\OptionsResolver; |
| 11 | |
| 12 | class TaskType extends AbstractType |
| 13 | { |
| 14 | /** |
| 15 | * Build the form for creating or editing a task. |
| 16 | * |
| 17 | * @param FormBuilderInterface $builder The form builder. |
| 18 | * @param array<mixed> $options The options for this form. |
| 19 | * @return void |
| 20 | */ |
| 21 | public function buildForm(FormBuilderInterface $builder, array $options): void |
| 22 | { |
| 23 | $builder |
| 24 | ->add('title') |
| 25 | ->add('content') |
| 26 | ->add('author', EntityType::class, [ |
| 27 | 'class' => User::class, |
| 28 | 'choice_label' => 'username', |
| 29 | 'label' => 'Auteur', |
| 30 | 'placeholder' => 'Choisir un auteur', |
| 31 | 'required' => false, |
| 32 | ]); |
| 33 | } |
| 34 | } |