Skip to content

autowire on servicecontainer #18132

@FloSeas

Description

@FloSeas

I found a strand behavior with servicecontainer and autowire.

When I inject a service container and autowire it, the parameter bag is not resolved.

Basicly, with this definition of my service

    widget.manager:
        class: Widgets\Bundle\CoreBundle\Manager\WidgetManager
        arguments: ['@widget.renderer', '@service_container']

I am able to get parameters like:

$this->serviceContainer->getParameter('my.param')

But when I use autowire like this

    widget.manager:
        class: Widgets\Bundle\CoreBundle\Manager\WidgetManager
        autowire: true

on the same service, the parameter bag is not resolved and i get an error like "the prameter 'my parameter' does not exist".

Maybe it's a normal behavior, cause the service container is a special service, but we should have at least some meaningfull error.

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