Skip to content

Singly implemented interfaces are not being registered since v4.4 through DirectoryLoader #34524

@simPod

Description

@simPod

Symfony version(s) affected: 4.4.0

Description
Consider class A implements interface I

I used to register class A as a service. Then I DI autowired I. Symfony aliased I automatically to A on container init if there was only single implementation of A.

This behaviour is not working since v4.4. I'm getting:

Cannot autowire service "Service\With\Constructor": argument "$i" of method "__construct()" references interface "I" but no such service exists. You should maybe alias this interface to the existing "A" service.

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