I have an entity that looks like this:
/**
* @Gedmo\\Tree(type=\"nested\")
* @ORM\\Table(name=\"categories\")
* @ORM\\Entity()
*/
class Category extends
Solution using createQueryBuilder:
$query->SELECT('pa.id')
->from('Category', 'ca');
$query->join('ca.parent', 'pa');
$result = $query->getQuery()->getArrayResult();
You can use the currently undocumented IDENTITY
function to select the FK IDs in a query:
SELECT IDENTITY(c.parent) ...
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")