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

[FrameworkBundle][DX] ControllerNameParser does not handle invokable controllers #22338

Copy link
Copy link
Closed
@BPScott

Description

@BPScott
Issue body actions
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version 3.3.0-dev

Invokable controllers are coming! In routing config they're already addressable using a FQCN e.g. in a routing YAML:

home:
    path: /home
    defaults: { _controller: AppBundle\Controller\HomeController::__invoke }

And when #22330 is merged we can drop the __invoke:

defaults: { _controller: AppBundle\Controller\HomeController }

When defining routes it would be good to to also support invokable controllers using the shorter colon-based syntax. Currently the ControllerResolver / ControllerNameParser can't handle these two cases:

defaults: { _controller: AppBundle:Home:__invoke }

fails as it resolves to AppBundle\Controller\HomeController::__invokeAction which doesn't work for obvious reasons. Fixing this would be a case of not transforming __invoke into __invokeAction in the ControllerNameParser.

defaults: { _controller: AppBundle:Home }

Fails as this format doesn't get passed into the ControllerNameParser to be parsed in the ControllerResolver so thus results in a ServiceNotFoundException.

Expected Behaviour

Both AppBundle:Home and AppBundle:Home:__invoke should resolve to invoking AppBundle\Controller\HomeController.

(This ticket was spun out from comments on #22202).

Metadata

Metadata

Assignees

No one assigned

    Labels

    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.