Skip to content

Commit ccd9c1f

Browse files
committed
bug symfony#37276 [Form] Fixed block prefixes hierarchy of the CollectionType (yceruto)
This PR was merged into the 5.1 branch. Discussion ---------- [Form] Fixed block prefixes hierarchy of the CollectionType | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix symfony#37024 | License | MIT | Doc PR | - /cc @HeahDude Commits ------- a8f2c60 fixed block prefixes hierarchy of the CollectionType
2 parents a89cc6b + a8f2c60 commit ccd9c1f

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

+1-1
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

+3-3
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)