What I want to achieve is to get the controllers and routes as annotations from an Api folder created ad-hoc but it seems to not work correctly on symfony 5.1
Here is my config
services:
App\Controller\:
resource: '../../src/Controller'
tags: ['controller.service_arguments']
App\Api\:
resource: '../../src/Api'
tags: [ 'controller.service_arguments' ]
Api controller and route which is not matched
namespace App\Api;
/**
* @Route("/api", name="api")
*/
class ApiController extends AbstractController
{
/**
* @Route("{id}", methods="HEAD", options={"title":"Api Root"})
*/
public function head()
{
// TODO: Implement head() method.
}
/**
* @Route("{id}", methods="GET", options={"title":"Api Root"})
*/
public function index()
{
// NEVER CALLED
return "hello";
}
}
The route is not triggered and i get and exception. I'm missing something ?