Doctrine 2查询生成器的问题 [英] Problems with Doctrine 2 Query Builder
问题描述
我正在尝试使用Doctrine 2构建查询
I'm trying to build a query with Doctrine 2
$qb = $em->createQueryBuilder()
->select('*')
->from('Countries','c')
//getDQL
->getQuery();
echo "<pre>";
echo ($qb->execute());
echo "</pre>";
die;
出于某种原因,我遇到了错误:
for some reason I'm getting an error:
致命错误:未捕获的异常
'Doctrine\ORM\Query\QueryException'
带有消息'[语法错误]第0行,
col 7:错误:预期的
IdentificationVariable |
StateFieldPathExpression |
AggregateExpression | (子选择
) | ScalarExpression,在
/home/dodo/doctrine-orm/Doctrine/ORM/Query/QueryException.php
中获得 *
Fatal error: Uncaught exception 'Doctrine\ORM\Query\QueryException' with message '[Syntax Error] line 0, col 7: Error: Expected IdentificationVariable | StateFieldPathExpression | AggregateExpression | "(" Subselect ")" | ScalarExpression, got '*'' in /home/dodo/doctrine-orm/Doctrine/ORM/Query/QueryException.php on line 42
推荐答案
没有全局通配符之类的东西-您应该使用 c。*
。
There is no such a thing as "global wildcard" - you should use c.*
.
这篇关于Doctrine 2查询生成器的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!