Closed
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Symfony version | 3.3 |
These days we're updating the Symfony Demo app to use the new service configuration proposed for Symfony 3.3. See https://github.com/symfony/symfony-demo/pull/483/files
One of the things I like the least is this config:
services:
AppBundle\Twig\AppExtension:
$locales: '%app_locales%'
AppBundle\EventListener\RedirectToPreferredLocaleSubscriber:
$locales: '%app_locales%'
AppBundle\EventListener\CommentNotificationSubscriber:
$sender: '%app.notifications.email_sender%'
Having to create that boring config just to pass some container parameters destroys the purpose of this new config being RAD, etc.
Proposal
Would it make any sense to "autowire the parameters"?
Before
class AppExtension extends \Twig_Extension
{
// ...
public function __construct(Markdown $parser, $locales)
{
// ...
}
// ...
}
services:
AppBundle\Twig\AppExtension:
$locales: '%app_locales%'
After
class AppExtension extends \Twig_Extension
{
// ...
public function __construct(Markdown $parser, $locales = '%app_locales%')
{
// ...
}
// ...
}
Metadata
Metadata
Assignees
Labels
RFC = Request For Comments (proposals about features that you want to be discussed)RFC = Request For Comments (proposals about features that you want to be discussed)