-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Symfony version | 3.3 |
When services are autowired, parameter values still needs to be declared in definition like:
app.my_service:
class: AppBundle\Service\MyService
arguments:
- $clientHostParameter: "%client_host%"
What about guessing them based on variable name? For example:
class MyService
{
public function __construct(TwigEngine $twigEngine, $clientHostParameter)
{
//...
}
So if variable ends with word parameter
, S3 would tableize clientHost
, look for parameter client_host
and inject it.
An example taken from Symfony Flex demo would then become:
class RecipeLoader
{
public function __construct(LoggerInterface $logger, $kernelDebugParameter)
{
//...
}
What do you think?
Sorry if someone posted this idea before.
TomasVotruba