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

[DependencyInjection] Anonymous services are not removed along with the parent service  #30428

Copy link
Copy link
Closed
@marcospassos

Description

@marcospassos
Issue body actions

Description
When a definition is removed, I expect nested anonymous services to be removed as well:

How to reproduce

<service id="foo_service" class="Foo">
    <argument type="service">
        <service class="Bar">
            <argument>%bar.parameter%</argument>
        </service>
    </argument>
</service>

Extension:

if (!isset($config['option'])) {
    $container->removeDefinition('foo_service');

    return;
}

$container->setParameter('bar.parameter', $config['option']);

Compiling the container without option results in:

The service ".3_Bar~hJYmG7r" has a dependency on a non-existent parameter "bar.parameter".

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDependencyInjectionGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)Help wantedIssues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.Status: Needs Review

    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.