3

这是我正在使用的查询:

$q = $this->getEntityManager()->createQueryBuilder("SELECT e FROM ActionModule\Action e JOIN e.type t WHERE t.id IN (:ids)");

我已经尝试了每个参数分配选项:

  • :id
  • ?1
  • 内爆(',',$ids)
  • ?id

并且总是得到:

教义\ORM\Query\QueryException

[语法错误] line 0, col -1: Error: Expected IdentificationVariable | 标量表达式 | 聚合表达式 | 功能声明 | 部分对象表达式 | "(" 子选择 ")" | CaseExpression,得到字符串的结尾

非常感谢提前

编辑:

我已经倾倒$q->getQuery()->getDql()并得到: "SELECT" (6)

4

1 回答 1

4

createQueryBuilder不接受任何参数,其目的是使用构建器方法创建查询,而不是 DQL。

你需要的是createQuery.

$q = $this->getEntityManager()->createQuery("SELECT e FROM ActionModule\Action e JOIN e.type t WHERE t.id IN (:ids)");
于 2013-05-06T06:31:03.730 回答