Skip to content

[DependencyInjection] Services no longer injected into __invoke controllers method #27208

Closed
@MatTheCat

Description

@MatTheCat

Symfony version(s) affected: 4.1.0-BETA1

Description
After upgrading to 4.0.8 to 4.1.0-BETA1 some controllers stopped working, displaying

Controller "Controller" requires that you provide a value for the "$argument" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.

After some debugging it appears ServiceValueResolver's container doesn't contain the controller so its supports method returns false.

How to reproduce
Typehint a controller's __invoke method argument with a service class and then navigate to a route calling this method.

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