Skip to content

Commit a8f2c60

Browse files
committed
fixed block prefixes hierarchy of the CollectionType
1 parent a89cc6b commit a8f2c60

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
7272
*/
7373
public function finishView(FormView $view, FormInterface $form, array $options)
7474
{
75-
$prefixOffset = -1;
75+
$prefixOffset = -2;
7676
// check if the entry type also defines a block prefix
7777
/** @var FormInterface $entry */
7878
foreach ($form as $entry) {

src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ public function testEntriesBlockPrefixes()
415415

416416
$expectedBlockPrefixes = [
417417
'form',
418-
'text',
419418
'collection_entry',
419+
'text',
420420
'_fields_entry',
421421
];
422422

@@ -436,8 +436,8 @@ public function testEntriesBlockPrefixesWithCustomBlockPrefix()
436436
$this->assertCount(1, $collectionView);
437437
$this->assertSame([
438438
'form',
439-
'text',
440439
'collection_entry',
440+
'text',
441441
'field',
442442
'_fields_entry',
443443
], $collectionView[0]->vars['block_prefixes']);
@@ -454,8 +454,8 @@ public function testEntriesBlockPrefixesWithCustomBlockPrefixedType()
454454
$this->assertCount(1, $collectionView);
455455
$this->assertSame([
456456
'form',
457-
'block_prefixed_foo_text',
458457
'collection_entry',
458+
'block_prefixed_foo_text',
459459
'foo',
460460
'_fields_entry',
461461
], $collectionView[0]->vars['block_prefixes']);

0 commit comments

Comments
 (0)