Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Scope specific DIC #5300

Closed
Closed
@Josiah

Description

@Josiah

Almost every time that I have had a service which is dependant on the request you need to inject the entire container. The odd part is that these services are usually very lightweight and simple functionality.

For example, lets say that I want to create a KnpMenu voter which looks at the current URI of the request and then votes for the current menu item. Because the knp_menu.matcher service isn't in the request scope, I will create a scope widening injection error if I tag my request service with knp_menu.voter.

Ideally I should be able to tag a service which is dependant on request with knp_menu.voter and have it only be injected into knp_menu.matcher when the DIC is in the request scope.

I am happy to work on a PR to implement this but it would be good to know if there is anything that would stop this kind of functionality from being accepted first.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions