将请求传递给“knplabs/knp-paginator-bundle”包的 paginate() 方法时出现问题
/**
* @param integer $page
* @param integer $size
* @param Option\Locale $locale
*
* @return PaginationInterface
*/
public function all(int $page, int $size, Option\Locale $locale): PaginationInterface
{
$qb = $this->connection->createQueryBuilder()
->select(
'so.id',
'so.option_type_id',
'so.slug',
'so.position',
'so.name as default_name',
'sot.content as name',
'sot.locale',
)
->from('shop_options', 'so')
->leftJoin(
'so',
'shop_option_translations',
'sot',
'so.id = sot.object_id and sot.locale = :locale and sot.field = :name_field'
)
->setParameter(':locale', $locale->getName())
->setParameter(':name_field', Option\Option::NAME_FIELD)
->orderBy('so.position', 'ASC')
->execute();
$pagination = $this->paginator->paginate($qb, $page, $size); // Тут ошибка
$options = array_map(
static fn ($option) => $this->denormalizer->denormalize(
$option,
TranslatedOption::class,
'array',
[AbstractObjectNormalizer::DISABLE_TYPE_ENFORCEMENT => true]
),
(array)$pagination->getItems()
);
$pagination->setItems($options);
return $pagination;
错误:
{
"status_code": 500,
"message": "failure",
"data": [],
"meta": [],
"errors": [
{
"error": {
"message": "0",
"code": 0
},
"details": [],
"info": "One of listeners must count and slice given target"
}
]
}
没有分页,选择工作正常,我哪里出错了?