In my Dymfony2 / Doctrine2 application, I have a oneToMany relation between an object and its children.
I want to select all objects which have no children.
I'm stuck with various errors: SingleValuedAssociationField expected, Cannot add Having sth on non result variable, etc.
$queryBuilder = $this ->createQueryBuilder('object') ->leftJoin('object.children', 'children') ->andWhere('children IS NULL') // tested with a parameter, with addselect COUNT(children) and 0 condition, etc. ->getQuery() ->getResult();
How can I solve this?