关于where子句的DQL问题

时间:2014-11-12 00:25:30

标签: mysql symfony doctrine-orm dql

你好我有这个条款:

SELECT y,
CASE WHEN (v IS NULL) THEN 0 ELSE SUM(v.viewCount) END AS HIDDEN sumviewcount
FROM YTScraperBundle:YouTubeVideo y
LEFT JOIN y.allViews v WITH v.firstFetch BETWEEN :fromDate AND :toDate
GROUP BY y ORDER BY sumviewcount DESC

完全正常,但是当我尝试添加WHERE子句时,例如:

SELECT y,
CASE WHEN (v IS NULL) THEN 0 ELSE SUM(v.viewCount) END AS HIDDEN sumviewcount
FROM YTScraperBundle:YouTubeVideo y
LEFT JOIN y.allViews v WITH v.firstFetch BETWEEN :fromDate AND :toDate
WHERE y.name LIKE :videoName
GROUP BY y ORDER BY sumviewcount DESC

videoName的绑定方式如下:

$query->setParameter('videoName', "%" . $searchData['searchValue'] . "%");

所以这不是问题,无论如何我得到的错误是:

Error: Expected end of string, got 'y'","class":"Doctrine\\ORM\\Query\\QueryException

0 个答案:

没有答案