Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitbcfacac

Browse 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 parentsab2044f +7e89345 commitbcfacac

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

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

Lines 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-
publicfunctiongetName()
50-
{
51-
return$this->proxiedType->getName();
52-
}
53-
5446
/**
5547
* {@inheritdoc}
5648
*/
5749
publicfunctiongetBlockPrefix()
5850
{
59-
returnmethod_exists($this->proxiedType,'getBlockPrefix') ?$this->proxiedType->getBlockPrefix() :$this->getName();
51+
return$this->proxiedType->getBlockPrefix();
6052
}
6153

6254
/**

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

Lines 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
publicfunctiongetBlockPrefix()
6462
{

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

Lines 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+
publicfunctiongetBlockPrefix();
29+
2330
/**
2431
* Returns the parent type.
2532
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp