Skip to content

[DependencyInjection] Parameters are not expanded in indexed !tagged_locator #35337

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

Closed
rpkamp opened this issue Jan 14, 2020 · 1 comment · Fixed by #37243
Closed

[DependencyInjection] Parameters are not expanded in indexed !tagged_locator #35337

rpkamp opened this issue Jan 14, 2020 · 1 comment · Fixed by #37243

Comments

@rpkamp
Copy link
Contributor

rpkamp commented Jan 14, 2020

Description
When using a !tagged_locator with an index_by value, we can not use parameters inside those index_by values.

Example
parameters.yaml

parameters:
    foo: bar

services.yaml

services:
    service1:
        class: Foo\Bar
        tags:
            - { name: 'foo', key: '%foo%' }

    service2:
        class: Foo\BarLocator
        arguments:
            - !tagged_locator { tag: 'foo', index_by: 'key' }

Expected behaviour
I expect to be able to call the tagged_locator with the bar service (because %foo% is bar)

Actual behaviour
The service locator throws an exception that the service bar does not exist, only the service %foo% exists.

@nicolas-grekas
Copy link
Member

PR welcome.

@fabpot fabpot closed this as completed Jul 31, 2020
fabpot added a commit that referenced this issue Jul 31, 2020
…nts (rpkamp)

This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[DependencyInjection] Resolve parameters in tag arguments

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #35337
| License       | MIT
| Doc PR        | None, yet, will follow if this is accepted

Arguably this could be a BC break if people are actively relying on parameters not being resolved in tag parameters, although I can't come up with a sensible use case for that scenario.

Commits
-------

3dba1fe [DependencyInjection] Resolve parameters in tag arguments
fabpot added a commit that referenced this issue Aug 10, 2020
…g arguments" (rpkamp)

This PR was merged into the 5.2-dev branch.

Discussion
----------

Revert "[DependencyInjection] Resolve parameters in tag arguments"

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | #35337
| License       | MIT
| Doc PR        | N/A

Revert of earlier PR, see discussion #37243

Commits
-------

9731451 Revert "[DependencyInjection] Resolve parameters in tag arguments"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants