8000 [RFC] deprecate bundle:controller:action notation · Issue #25910 · symfony/symfony · GitHub
[go: up one dir, main page]

< 8000 div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
Skip to content
[RFC] deprecate bundle:controller:action notation #25910
Closed
@Tobion

Description

@Tobion
Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? yes
Symfony version 4.1

There are currently three ways to reference controllers in symfony:

  1. service:method, e.g. _controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController:redirectAction
  2. class::method, e.g. _controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
  3. bundle:controller:action, e.g. _controller: FrameworkBundle:Redirect:redirect

Having many ways to do the same thing just confuses people. And the old bundle:controller:action notation does not fit anymore for several reasons:

  1. bundle:controller:action does not work with bundle-less apps obviously
  2. Symfony 4 is advocating defining controllers as services. Symfony framework bundle itself also defines controllers as services since [Bridge\Doctrine][FrameworkBundle] Deprecate some remaining uses of ContainerAwareTrait #24409. So service:method would work as well.
  3. it causes overhead for parsing different notations and workarounds like Parse the _controller format in sub-requests #23013
  4. bundle:controller:action also doesn't work when using invokable controllers ([FrameworkBundle][DX] ControllerNameParser does not handle invokable controllers #22338)
  5. bundle:controller:action assumes a certain namespace structure and *Action suffix for controllers, see https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php#L70-L73 This is not fit the new documented best practice to not use the *Action suffix anymore, see https://symfony.com/doc/current/routing.html which does not use it.
  6. when using annotations for routes, you don't care about these things anyway

For these reasons I think we should deprecate this notation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrameworkBundleRFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0