我想在回复中加入_redirects
和public
,所以我遵循了文档https://api-platform.com/docs/core/pagination/#custom-controller-action,但出现此错误
“控制器必须返回一个“ Symfony \ Component \ HttpFoundation \ Response”对象,但它返回的是ApiPlatform \ Core \ Bridge \ Doctrine \ Orm \ Paginator类型的对象。”
hydra:totalItems
hydra:view
答案 0 :(得分:0)
解决了! 我忘记的是注释中的默认参数
/**
* @Route(
* name="api_fake_action",
* path="/api/fake",
* defaults={
* "_api_resource_class"=FakeEntity::class,
* "_api_collection_operation_name"="post_publication"
* }
* )
*/
public function __invoke(): Paginator
{
return $this->termRelationshipsRepository->findAllProductsIdsByTerm_id(126);
}