bug #17162 [Form] Fix regression on Collection type (hason)

This PR was merged into the 2.8 branch.

Discussion
----------

[Form] Fix regression on Collection type

Q | A
--- | ---
Bug fix? 	| yes
New feature? | no
BC breaks? | no
Deprecations? | no
Tests pass? | yes
Fixed tickets |
License | MIT
Doc PR |

A regression was introduced in #17044.

Commits
-------

bd686cd [Form] Fixed regression on Collection type
This commit is contained in:
Nicolas Grekas 2015-12-29 15:18:28 +01:00
commit be95db892d
2 changed files with 5 additions and 1 deletions

View File

@ -30,7 +30,7 @@ class CollectionType extends AbstractType
$prototypeOptions = array_replace(array(
'required' => $options['required'],
'label' => $options['prototype_name'].'label__',
), $options['options']);
), $options['entry_options']);
if (null !== $options['prototype_data']) {
$prototypeOptions['data'] = $options['prototype_data'];

View File

@ -311,10 +311,12 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'entry_options' => array(
'data' => 'bar',
'label' => false,
),
));
$this->assertSame('foo', $form->createView()->vars['prototype']->vars['value']);
$this->assertFalse($form->createView()->vars['prototype']->vars['label']);
}
/**
@ -328,9 +330,11 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'options' => array(
'data' => 'bar',
'label' => false,
),
));
$this->assertSame('bar', $form->createView()->vars['prototype']->vars['value']);
$this->assertFalse($form->createView()->vars['prototype']->vars['label']);
}
public function testPrototypeDefaultRequired()