语法错误:预期字面量为“ ORDER”

时间:2018-11-07 10:04:50

标签: symfony doctrine sonata

我在symfony 2.8中遇到此错误:

3/3] Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("[Syntax Error] line 0, col 128: Error: Expected Literal, got 'ORDER'").  -

第33行是

    {% if admin.datagrid.results|length > 0 %}

 QueryException ::dqlError ('SELECT o FROM Work\SeoControlBundle\Entity\Domain o LEFT JOIN o.strategy s_strategy LEFT JOIN o.renderer s_renderer WHERE ORDER BY o.id ASC')
in vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php at line 448

2 个答案:

答案 0 :(得分:0)

欢迎使用SO。

您的WHERE条件为空。删除它或用必要的条件填充它:)

SELECT o FROM Work\SeoControlBundle\Entity\Domain o LEFT JOIN o.strategy s_strategy LEFT JOIN o.renderer s_renderer ORDER BY o.id ASC

SELECT o FROM Work\SeoControlBundle\Entity\Domain o LEFT JOIN o.strategy s_strategy LEFT JOIN o.renderer s_renderer WHERE XXX=YYY ORDER BY o.id ASC

答案 1 :(得分:0)

您只需要更改您的存储库类文件。删除where条件,因为它似乎为空。