[Form] Fixed regression on Collection type

This commit is contained in:
Martin Hasoň 2015-12-29 03:17:50 +01:00
parent a7e5b4932e
commit bd686cd1ee
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()