我正在尝试在我的 Symfony2 项目中查询模型,但我遇到了一个我无法弄清楚的小问题。看一下这个:
$q2 =
'SELECT
p.code,
p.desc,
SUM(d.quantity) as quantity,
SUM(d.quantity*d.prize) as euros
FROM
Product p
JOIN
TransactionDetail d
JOIN
d.transaction t
WHERE
d.product IN :array
AND
t.shop = :shop
GROUP BY
p.code';
$query2 = $this->em->createQuery($q2)
->setParameter('shop', $shop)->setParameter('array', $array);
$result = $query2->getResult();
我得到这个错误:
[Syntax Error] line 0, col 248: Error: Expected =, <, <=, <>, >, >=, !=, got 't'
我不明白。有人能帮我一下吗?
谢谢。