Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2034e96

Browse files
committed
[Form] CollectionType uses hardcoded FQCN
1 parent 3c08e10 commit 2034e96

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

reference/forms/types/collection.rst

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,9 @@ in a form. For example, suppose you have an ``emails`` field that corresponds
5454
to an array of email addresses. In the form, you want to expose each email
5555
address as its own input text box::
5656

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(
6258
// 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',
6460
// these options are passed to each "email" type
6561
'entry_options' => array(
6662
'required' => false,
@@ -294,12 +290,8 @@ as your `entry_type`_ option (e.g. for a collection of drop-down menus),
294290
then you'd need to at least pass the ``choices`` option to the underlying
295291
type::
296292

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',
303295
'entry_options' => array(
304296
'choices' => array(
305297
'nashville' => 'Nashville',
@@ -378,13 +370,9 @@ for all entries with the ``entry_options`` option will be used.
378370

379371
.. code-block:: php
380372
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(
386374
'class' => 'AppBundle\Entity\Tag',
387-
'entry_type' => TextType::class,
375+
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
388376
'allow_add' => true,
389377
'prototype' => true,
390378
'prototype_data' => 'New Tag Placeholder',

0 commit comments

Comments
 (0)