I face this Error while creating a REST API using Symfony V4.99 and fosrestbundle
.
When I Run php bin/console debug:router
I get this:
Cannot load resource "App\Controller\ListController". Make sure there is a loader supporting the "rest" type.
Here is the code of Routes.yaml:
lists:
type : rest
resource : App\Controller\ListController
prefix : api
Here is the code of fos_rest.yaml :
fos_rest:
format_listener:
rules:
- { path: ^/, fallback_format: json, priorities: [ 'json' ] }
exception:
enabled: true
view:
view_response_listener: 'force'
formats:
json: true
Here is the code of ListController.php:
<?php
namespace App\Controller;
use Symfony\Component\Routing\Annotation\Route;
use FOS\RestBundle\Controller\AbstractFOSRestController;
use FOS\RestBundle\Controller\Annotations as Rest;
class ListController extends AbstractFOSRestController
{
public function getListsAction()
{
}
}