[英]Syntax Error: line 0, col 72: Error: Expected end of string, got 'b6f037'
[英]Doctrine Error on attempting to retrieve a boolean value - line 0, col 111: Error: Expected end of string, got '1'
我正在嘗試在學說查詢中檢索布爾值。 我可以在學說查詢中成功檢索到String值,但是在從Entity類中添加一個變量名稱為active的布爾參數時,出現錯誤
[Syntax Error] line 0, col 111: Error: Expected end of string, got '1'
完整的學說摘要
$results = $this->getDoctrine()->getRepository('RealBundle:Cats')
->createQueryBuilder('q')
->addSelect('ABS(q.pts) AS HIDDEN pointsOrder')
->orderBy('pointsOrder', 'DESC')
->orderBy('active', TRUE) //code fails at this point
->getQuery()
->getResult();
請問我能做些什么
嘗試更改為此:
$results = $this->getDoctrine()->getRepository('RealBundle:Cats')
->createQueryBuilder('q')
->addSelect('ABS(q.pts) AS HIDDEN pointsOrder')
->addOrderBy('pointsOrder', 'DESC')
->addOrderBy('active', 'ASC') //code fails at this point
->getQuery()
->getResult();
您需要使用addOrderBy
來使用多個訂單,並且addOrderBy
第二個參數必須為ASC
或DESC
,不能為TRUE
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.