0
我想一個變量設置成的狀態設置一個變量爲DQL查詢
情況的基礎上,DQL查詢時都varibale值都匹配的變量設置等級。
DQL查詢
$q=$this->em->createQuery("select distinct u.id,u.city,u.country,u.designation FROM Entities\User u JOIN Entities\EventVisitor evt_vstr WITH evt_vstr.user = u.id WHERE (
CASE
WHEN $a =u.designation THEN SET @rank=1
WHEN $b =u.country THEN SET @rank=2
WHEN $c =u.city THEN SET @rank=3
WHEN $d =u.company THEN @rank=4
END) order by @rank")
->setFirstResult($i)
->setMaxResults($max_result);
$results = $q->getResult();
這裏排名是我想設置
問題IM面臨
- IM無法設置變量DQL變量。
錯誤日誌
PHP Fatal error: Uncaught exception 'Doctrine\\ORM\\Query\\QueryException' with message 'select distinct u.id, u.city,u.country,u.designation FROM Entities\\User u JOIN Entities\\EventVisitor evt_vstr WITH evt_vstr.user = u.id \n\t \t\t\t\t\tWHERE (\n\t\t\t\t\t\t\t\t\tCASE\n\t\t\t\t\t\t\t\t\t\t\t\tWHEN Co-founder =u.designation THEN SET @rank=1\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tEND ) ' in /home/india/public_html/serve-trade-com/application/libraries/Doctrine/ORM/Query/QueryException.php:39\nStack
但它不工作。
我該怎麼做?
或有任何辦法做到這一點
請幫