Doctrine Querybuilder ORDER BY clause is not in SELECT list

后端 未结 5 1440
清歌不尽
清歌不尽 2021-02-08 08:29

I have the following query builder:

$queryBuilder = $this
    ->createQueryBuilder(\'recipient\')
    ->leftJoin(\'recipient.message\', \'message\')
    -&         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-08 09:05

    There is a bug reported in #4846 and it seems to be related to #sqlmode_only_full_group_by and there are some examples abaut what does it mean here. Until a proper fix comes out a solution would be to add ->addSelect('message') to the query (I don't know if it fixes the issue or doctrine rewrites the query anyway), but that way doctrine will hydrate massages as well which maybe not desired or disable ONLY_FULL_GROUP_BY sql mode, but then, mysql maybe can return invalid data.

提交回复
热议问题