I moved all controllers to /src/Web/Controller
in the Symfony 6 project as shown below
├── src │ ├── ... │ └── Web │ | ├── Controller │ | ├── .... | |── Kernel.php
Myroutes.yaml
Modify accordingly
#routes.yaml controllers: resource: ../src/Web/Controller/ type: annotation
Now the problem is that all my routes have a name prefixed with app_web
. I guess it's due to this structure.
$ php bin/console debug:router
The command output is as follows:
... ... app_web_post_index GET|HEAD ANY ANY /post/ app_web_post_create GET|HEAD|POST ANY ANY /post/create
Here I only want the name to be post_ind
If you don't name the routes explicitly, they will be named for you.
Thename is generated using the fully qualified names of the controller's classes and methods (although for some reason there is no last part of the namespace -
controller
).If you don't want to use the automatically generated name, just name your route yourself:
Use �%8