-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Calls does not apply to service via autoconfigure #23497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is not related to Here, you're registering your controllers as services using the PSR-4 based discovery, that basically means "this defines as much services as there are classes in this namespace/directory`. |
i have done this with normal services (specially abstract ones), but is there a way for " |
What about |
|
AppBundle\Controller\Admin\Block\BlockController:
parent: AppBundle\Controller\Admin\Block\ Because |
Note that we maybe could do something about this: |
Makes sense to me, I will do! For 3.3 the alternatives seems to create an abstract service extended by both _defaults:
autoconfigure: true
app.admin.abstract_controller:
abstract: true
public: true
calls:
- ['setLogger', ['@logger']]
AppBundle\Controller\Admin\:
parent: app.admin.abstract_controller
resource: '../../../src/AppBundle/Controller/Admin'
tags: ['controller.service_arguments']
AppBundle\Controller\Admin\Block\BlockController:
parent: app.admin.abstract_controller
tags:
- { name: controller.service_arguments }
- { name: app.admin, group: site } Or use _instanceof:
Symfony\Bundle\FrameworkBundle\Controller\Controller: # better use your own base controller
public: true
tags: ['controller.service_arguments']
calls:
- ['setLogger', ['@logger']]
AppBundle\Controller\Admin\:
resource: '../../../src/AppBundle/Controller/Admin'
AppBundle\Controller\Admin\Block\BlockController:
tags:
- { name: app.admin, group: site } |
If its just about the logger, why not implementing |
@Basster It was just an example. Unfortunately, I try to refactor an lagacy app, so can't easily use interfaces. In my new app I use exactly this approach |
See #23548 |
Closing as "won't implement". See experiment in #23548, which didn't go well enough :) |
Calls did not apply to the service.
If I remove additional definition for
AppBundle\Controller\Admin\Block\BlockController
with tag, then all works correctThe text was updated successfully, but these errors were encountered: