这个查询:
$this->getEntityManager()
->createQuery("SELECT k FROM FooBarBundle:Kode k WHERE k.kode LIKE :keyword OR k.nama LIKE :keyword ORDER BY k.kode ASC")
->setParameter("keyword", "%$keyword%")
->setMaxResults($limit)
->setFirstResult($offset)
->getResult();
生成以下 SQL 错误:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OFFSET 0' at line 1
但是,如果我删除该setFirstResult($offset)
行,它就可以正常工作。是否有任何解决方法而不是升级整个 Doctrine 库(补丁可能很好)?