Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 6 |
| ItemCollectionType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 6 |
| configureOptions | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 6 |
|||
| <?php | |
| declare(strict_types=1); | |
| namespace App\UI\HTTP\REST\FormType; | |
| use Symfony\Component\Form\Extension\Core\Type\CollectionType; | |
| use Symfony\Component\OptionsResolver\OptionsResolver; | |
| use Symfony\Component\Validator\Constraints\Count; | |
| final class ItemCollectionType extends CollectionType | |
| { | |
| public function configureOptions(OptionsResolver $resolver): void | |
| { | |
| parent::configureOptions($resolver); | |
| $resolver->setDefaults([ | |
| 'empty_data' => [], | |
| 'entry_type' => ItemType::class, | |
| 'allow_add' => true, | |
| 'constraints' => [ | |
| new Count([ | |
| 'min' => 1, | |
| 'minMessage' => 'The collection must contain at least {{ limit }} item.', | |
| ]), | |
| ], | |
| ]); | |
| } | |
| } |