INTERVAL 1 MONTH not working With symfony2 doctrine?

前端 未结 2 2124
伪装坚强ぢ
伪装坚强ぢ 2021-02-15 18:54

I am stuck here and i spend last 2 days resolving this issue but failed. I am writing a query inside my repository to get the entries for current month. here is my query:-

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-15 19:24

    You have to remember that DQL is not SQL. The error comes from Doctrine's Lexer and not from MySQL. DQL doesn't support INTERVAL (see list of supported functions).

    Read more on adding your own functions, specifically adding DATE_ADD with INTERVAL support here: http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/cookbook/dql-user-defined-functions.html#date-add

提交回复
热议问题