0
我用下面錯誤:PathExpression無效。必須是SingleValuedAssociationField。在Doctrine2
$qb = $this->createQueryBuilder('cat');
$result = $qb
->select('IDENTITY(c.name) AS catname')
->leftJoin("CatalogueBundle:Product", 'p',
Join::WITH,
'cat.product = p.id')
->leftJoin("CatalogueBundle:Category", 'c',
Join::WITH,
'cat.category = c.id')
->where('p.id =:product')
->setParameter('product',$productId)
->getQuery()
->getResult();
return $result;
從在Symfony2的兩個查詢得到的數據,但它給下面的錯誤
[Semantical Error] line 0, col 18 near 'name) AS catname': Error: Invalid PathExpression. Must be a SingleValuedAssociationField.
存在CatalogueBundle:Category
實體字段名。不能找到爲什麼會發生?