Reputation: 133
I'm trying to query the model in my Symfony2 project, and I have a little problem that I can't figure out. Check this out:
$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();
And I get this error:
[Syntax Error] line 0, col 248: Error: Expected =, <, <=, <>, >, >=, !=, got 't'
I don't understand it. Can anyone help me here?
Thanks.
Upvotes: 0
Views: 126
Reputation: 8645
I think you should link TransactionDetail with another entity :
Currently :
JOIN
TransactionDetail d
Should be:
JOIN
p.transactionDetail d
Upvotes: 1