尝试使用 symfony 运行查询,但出现此错误:
[Syntax Error] line 0, col 83: Error: Expected end of string, got 'username'
此代码引发该错误:
$query = $em->createQuery(
'SELECT username
FROM BLOGBlogBundle:user
WHERE username= :usrname'
)->setParameter('usrname', $usr);
$products = $query->getResult();
我究竟做错了什么?