How to change Controller folder path ? #42487
-
Hello, On Symfony 5.3 we can no longer configure the Controller folder path in the 'config / services.yaml' file as before. services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
- '../src/Tests/'
App\UserInterface\Controller\:
resource: '../src/UserInterface/Controller'
tags: ['controller.service_arguments'] Where should we now change it? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
All classes that extend |
Beta Was this translation helpful? Give feedback.
All classes that extend
AbstractController
are already automatically tagged withcontroller.service_arguments
without the need for an explicit tagging during loading. And as of Symfony 5.3, this is also true for any classes tagged as#[AsController]
on PHP 8+.That's why the explicit tagging during loading has been removed from the recipe: the recommended way is to either extend AbstractController or to use the attribute (and then, the loading of the whole
src
folder already makes those controller work)