I have a project legacy that I have been updating since symfony 2. Now I am at 6.4 however my routes stoped working.
In my routing.yml i am trying to fix the routes in the Admin folder.
Following the documentation https://symfony.com/doc/6.4/routing/custom_route_loader.html
but is not working.
I have tried:
app_admin:
resource: ../../src/AppBundle/Controller/Admin/
type: attribute
And the error is:
In FileLoader.php line 182:
Warning: Array to string conversion in app/config/../../src/AppBundle/Controller/Admin/ (which is being imported from app/config/routing.yml"). Make sure there is a loader supporting the "attribute" type.
In AttributeClassLoader.php line 219:
Warning: Array to string conversion
I also have tried:
app_admin:
# loads routes from the PHP attributes of the controllers found in the given PSR-4 namespace root
resource:
path: '../../src/AppBundle/Controller/Admin/'
namespace: App\Controller\Admin
type: attribute
However the $ php bin/console debug:router
does not load any routes.
If I change the routing.yml to add each class it works, but I don’t think it is the best way to do it. Adding each class is going to be a pain.
app_admin:
resource: "@AppBundle/Controller/Admin/AdminController.php"
type: attribute
Anyone have a clue what I am missing?
shouldn’t it be
path: '../src/AppBundle/Controller/Admin/'