Symfony2 and Doctrine - Error: Invalid PathExpression. Must be a StateFieldPathExpression
You can use the currently undocumented IDENTITY
function to select the FK IDs in a query:
SELECT IDENTITY(c.parent) ...
Solution using createQueryBuilder:
$query->SELECT('pa.id') ->from('Category', 'ca');$query->join('ca.parent', 'pa');$result = $query->getQuery()->getArrayResult();
You are selecting an object that is not joined. Like said in another answer, you have to do something like :
qb->innerJoin("c.parent", "p")