Skip to content

[DependencyInjection] support anonymous services as bound defaults #26629

@dkarlovi

Description

@dkarlovi
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes
Symfony version 4.0

If I do this:

    <services>
        <defaults public="false" autoconfigure="true" autowire="true">
            <bind key="Imagine\Image\ImagineInterface" type="service">
                <service parent="liip_imagine.imagick">
                    <call method="setMetadataReader">
                        <argument type="service">
                            <service id="App\Infrastructure\Imagine\Metadata\ExifMetadataReader" lazy="true"/>
                        </argument>
                    </call>
                </service>
            </bind>
        </defaults>
    </services>

I get Tag "<bind>" with type="service" has no or empty "id" attribute. But it should be possible, no?

I'm trying to do it like this since services with parent can't be in a file with defaults bound:

Bound values on service "foo" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file.

This might actually be a bug, not sure.

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