@@ -54,13 +54,9 @@ in a form. For example, suppose you have an ``emails`` field that corresponds
54
54
to an array of email addresses. In the form, you want to expose each email
55
55
address as its own input text box::
56
56
57
- use Symfony\Component\Form\Extension\Core\Type\CollectionType;
58
- use Symfony\Component\Form\Extension\Core\Type\EmailType;
59
- // ...
60
-
61
- $builder->add('emails', CollectionType::class, array(
57
+ $builder->add('emails', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array(
62
58
// each entry in the array will be an "email" field
63
- 'entry_type' => EmailType::class ,
59
+ 'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\ EmailType' ,
64
60
// these options are passed to each "email" type
65
61
'entry_options' => array(
66
62
'required' => false,
@@ -294,12 +290,8 @@ as your `entry_type`_ option (e.g. for a collection of drop-down menus),
294
290
then you'd need to at least pass the ``choices `` option to the underlying
295
291
type::
296
292
297
- use Symfony\Component\Form\Extension\Core\Type\CollectionType;
298
- use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
299
- // ...
300
-
301
- $builder->add('favorite_cities', CollectionType::class, array(
302
- 'entry_type' => ChoiceType::class,
293
+ $builder->add('favorite_cities', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array(
294
+ 'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType',
303
295
'entry_options' => array(
304
296
'choices' => array(
305
297
'nashville' => 'Nashville',
@@ -378,13 +370,9 @@ for all entries with the ``entry_options`` option will be used.
378
370
379
371
.. code-block :: php
380
372
381
- use Symfony\Component\Form\Extension\Core\Type\CollectionType;
382
- use Symfony\Component\Form\Extension\Core\Type\TextType;
383
- // ...
384
-
385
- $builder->add('tags', CollectionType::class, array(
373
+ $builder->add('tags', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array(
386
374
'class' => 'AppBundle\Entity\Tag',
387
- 'entry_type' => TextType::class ,
375
+ 'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\ TextType' ,
388
376
'allow_add' => true,
389
377
'prototype' => true,
390
378
'prototype_data' => 'New Tag Placeholder',
0 commit comments