【发布时间】:2017-05-29 12:04:58
【问题描述】:
我有以下疑问:
$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);
添加翻译提示后,排序停止工作,并且出现以下异常:
Cannot select distinct identifiers from query with LIMIT and ORDER BY on a column from a fetch joined to-many association. Use output walkers.
我看到了使用 Knp Paginator 的解决方案,但我使用了 Doctrine 中的默认分页器。
在我的情况下,解决方案是什么?谢谢。
【问题讨论】: