We're using Symfony2's class table inheritance and I was trying to work out how to select only some subclasses using Doctrine2. It turned out to be pretty easy.
SELECT e FROM MyCustomBundle:ParentEntity e WHERE e NOT INSTANCE OF MyCustomBundle:ExcludedChildEntity
In the discriminator map in the super class you refer to the full qualified namespace and class name (\My\CustomBundle\Entity\ExcludedChildEntity) but in the DQL it works with Symfony2's shorthand.
$builder = $repository->createQueryBuilder('entity')
->where('entity NOT INSTANCE OF MyCustomBundle:ParentEntity');
Pretty good trick, thanks !
Antoine / 12:48am / 9 December 2014