Doctrine orm Gedmo可翻译与原则Paginator
我有以下疑问:Doctrine orm Gedmo可翻译与原则Paginator,doctrine-orm,symfony-2.7,Doctrine Orm,Symfony 2.7,我有以下疑问: $this->qb->select('partial transporter.{id,name,transporterType,routes}') ->from($this->entity, 'transporter', null) ->addSelect('partial country.{id,name}') ->addSelect('partial county.{i
$this->qb->select('partial transporter.{id,name,transporterType,routes}')
->from($this->entity, 'transporter', null)
->addSelect('partial country.{id,name}')
->addSelect('partial county.{id,shortName}')
->leftJoin('transporter.country', 'country')
->leftJoin('transporter.county', 'county')
and many other selects and joins...
排序、筛选和分页工作正常,直到我添加:
$query->setHint(\Doctrine\ORM\Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
$query->setHint(\Gedmo\Translatable\TranslatableListener::HINT_TRANSLATABLE_LOCALE, $this->locale);
添加翻译提示后,排序停止工作,出现以下异常:
无法从与多个关联关联关联关联的获取中的列上使用LIMIT和ORDER BY的查询中选择不同的标识符。使用输出步行器。
我看到了使用Knp Paginator的解决方案,但我使用了Doctrine中的默认Paginator
对我来说,解决办法是什么?谢谢。答案很简单。我只需要将outputwalkers设置为true
$paginator = new Paginator($this->execute(), true);
$paginator->setUseOutputWalkers(true);
答案很简单。我只需要将outputwalkers设置为true
$paginator = new Paginator($this->execute(), true);
$paginator->setUseOutputWalkers(true);