Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

test.service_container doesn't work with private shared:false services #27488

Copy link
Copy link
Closed
@vfalduto

Description

@vfalduto
Issue body actions

Symfony version(s) affected: 4.1.x

Description

test.service_container doesn't work with private shared:false services

App\MyService:
    shared: false
    public: false 

When we try to load the MyService from the new "test.service_container" we have an exception :

 $client = static::createClient();
 $privateContainer = $client->getContainer();
 $privateContainer->get(App\MyService::class);

The 'AppMyService' service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.

Possible Solution

Additional context

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.