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

Commitc2020bb

Browse files
[FrameworkBundle] AddControllerHelper; the helpers from AbstractController as a standalone service
1 parenta3c1d1f commitc2020bb

File tree

6 files changed

+557
-13
lines changed

6 files changed

+557
-13
lines changed

‎src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
7.4
55
---
66

7+
* Add`ControllerHelper`; the helpers from AbstractController as a standalone service
78
* Allow using their name without added suffix when using`#[Target]` for custom services
89
* Deprecate`Symfony\Bundle\FrameworkBundle\Console\Application::add()` in favor of`Symfony\Bundle\FrameworkBundle\Console\Application::addCommand()`
910
* Add`assertEmailAddressNotContains()` to the`MailerAssertionsTrait`

‎src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,6 @@ public function setContainer(ContainerInterface $container): ?ContainerInterface
6767
return$previous;
6868
}
6969

70-
/**
71-
* Gets a container parameter by its name.
72-
*/
73-
protectedfunctiongetParameter(string$name):array|bool|string|int|float|\UnitEnum|null
74-
{
75-
if (!$this->container->has('parameter_bag')) {
76-
thrownewServiceNotFoundException('parameter_bag.',null,null, [],\sprintf('The "%s::getParameter()" method is missing a parameter bag to work properly. Did you forget to register your controller as a service subscriber? This can be fixed either by using autoconfiguration or by manually wiring a "parameter_bag" in the service locator passed to the controller.',static::class));
77-
}
78-
79-
return$this->container->get('parameter_bag')->get($name);
80-
}
81-
8270
publicstaticfunctiongetSubscribedServices():array
8371
{
8472
return [
@@ -96,6 +84,18 @@ public static function getSubscribedServices(): array
9684
];
9785
}
9886

87+
/**
88+
* Gets a container parameter by its name.
89+
*/
90+
protectedfunctiongetParameter(string$name):array|bool|string|int|float|\UnitEnum|null
91+
{
92+
if (!$this->container->has('parameter_bag')) {
93+
thrownewServiceNotFoundException('parameter_bag.',null,null, [],\sprintf('The "%s::getParameter()" method is missing a parameter bag to work properly. Did you forget to register your controller as a service subscriber? This can be fixed either by using autoconfiguration or by manually wiring a "parameter_bag" in the service locator passed to the controller.',static::class));
94+
}
95+
96+
return$this->container->get('parameter_bag')->get($name);
97+
}
98+
9999
/**
100100
* Generates a URL from the given parameters.
101101
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp