diff --git a/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php b/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php index d4023ecb5f38..ea6a6d5ffec1 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php @@ -72,7 +72,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) */ public function finishView(FormView $view, FormInterface $form, array $options) { - $prefixOffset = -1; + $prefixOffset = -2; // check if the entry type also defines a block prefix /** @var FormInterface $entry */ foreach ($form as $entry) { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php index a610c24a044b..3d2ac4fe9c62 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php @@ -415,8 +415,8 @@ public function testEntriesBlockPrefixes() $expectedBlockPrefixes = [ 'form', - 'text', 'collection_entry', + 'text', '_fields_entry', ]; @@ -436,8 +436,8 @@ public function testEntriesBlockPrefixesWithCustomBlockPrefix() $this->assertCount(1, $collectionView); $this->assertSame([ 'form', - 'text', 'collection_entry', + 'text', 'field', '_fields_entry', ], $collectionView[0]->vars['block_prefixes']); @@ -454,8 +454,8 @@ public function testEntriesBlockPrefixesWithCustomBlockPrefixedType() $this->assertCount(1, $collectionView); $this->assertSame([ 'form', - 'block_prefixed_foo_text', 'collection_entry', + 'block_prefixed_foo_text', 'foo', '_fields_entry', ], $collectionView[0]->vars['block_prefixes']);