Skip to content

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

@rpkamp

Description

@rpkamp

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.

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