Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bcfacac

Browse filesBrowse files
committed
minor #16749 [Form] Added getBlockPrefix() to ResolvedFormTypeInterface (webmozart)
This PR was merged into the 3.0-dev branch. Discussion ---------- [Form] Added getBlockPrefix() to ResolvedFormTypeInterface | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This is the follow-up PR to #16724. If you call `$form->getConfig()->getType()`, all the methods of FormType should be usable. In that sense, ResolvedFormType is the developer-facing version of FormType. It is true that the same could be achieved with `getInnerType()`, but that method should be used in edge cases only as it clutters the code and makes it confusing to read: ```php $blockPrefix = $form->getConfig()->getType()->getInnerType()->getBlockPrefix(); ``` Commits ------- 7e89345 [Form] Added getBlockPrefix() to ResolvedFormTypeInterface
2 parents ab2044f + 7e89345 commit bcfacac
Copy full SHA for bcfacac

File tree

3 files changed

+9
-12
lines changed
Filter options

3 files changed

+9
-12
lines changed

‎src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php
+1-9Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,12 @@ public function __construct(ResolvedFormTypeInterface $proxiedType, FormDataColl
4343
$this->dataCollector = $dataCollector;
4444
}
4545

46-
/**
47-
* {@inheritdoc}
48-
*/
49-
public function getName()
50-
{
51-
return $this->proxiedType->getName();
52-
}
53-
5446
/**
5547
* {@inheritdoc}
5648
*/
5749
public function getBlockPrefix()
5850
{
59-
return method_exists($this->proxiedType, 'getBlockPrefix') ? $this->proxiedType->getBlockPrefix() : $this->getName();
51+
return $this->proxiedType->getBlockPrefix();
6052
}
6153

6254
/**

‎src/Symfony/Component/Form/ResolvedFormType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ResolvedFormType.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ public function __construct(FormTypeInterface $innerType, array $typeExtensions
5656
}
5757

5858
/**
59-
* Returns the prefix of the template block name for this type.
60-
*
61-
* @return string The prefix of the template block name
59+
* {@inheritdoc}
6260
*/
6361
public function getBlockPrefix()
6462
{

‎src/Symfony/Component/Form/ResolvedFormTypeInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ResolvedFormTypeInterface.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
*/
2121
interface ResolvedFormTypeInterface
2222
{
23+
/**
24+
* Returns the prefix of the template block name for this type.
25+
*
26+
* @return string The prefix of the template block name
27+
*/
28+
public function getBlockPrefix();
29+
2330
/**
2431
* Returns the parent type.
2532
*

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.