Я использую Api-Plateform в Создание пользовательских операций и контроллеров
Я хотел бы получить все ресурсы, и я создаю сервис для настройки моегоПоставщики данных здесь
// in Controller
public function getListClient(Client $data)
{
$obj = $this
->productCollectionDataProvider
->getCollection($data);
return $obj;
}
//=================================
// My service
//=================================
public function getCollection( $resourceClass,
$operationName = null)
{
if (Client::class !== $resourceClass){
throw new ResourceClassNotSupportedException();
}
// Autowiring repository
$data = $this->repository->findAll();
return $data;
}
//=================================
// here my Entity
//=================================
/**
* @ApiResource(collectionOperations={
* "get",
* "special"={"route_name"="get_list_client"}
* })
*
*/
class Client
{
//.....
}
//=================================
// My Route
//=================================
get_list_client:
path: /client/special
methods: ['GET']
defaults:
_controller: App\Controller\ApiClient::getListClient
_api_resource_class: App\Entity\Client
_api_collection_operation_name: special
Я не понимаю, почему возникает ошибка Идентификатор идентификатора отсутствует для запроса
Если кто-то может объяснитьмне collectionOperations в пользовательских операциях и контроллерах