Question: I have two entities that share an abstract class creating class table inheritance. I can query for the entities by using the abstract class' repository and get all the entities that extend the abstract class as the result. 

```
$qb = $this->createQueryBuilder('c')
    ->where('c.featured = true')
    ->orderBy('c.sticky', 'DESC')
    ->addOrderBy('c.weight', 'ASC')
    ->setFirstResult($offset)
    ->setMaxResults($limit);

// Returns 8 results, results in 34 queries

```

The sub classes contain ManyToMany relationships to other entities so if I query in this manner, those relationships result in additional queries since they are not being joined. How can you query for entities extending an abstract class and join their columns? I tried adding multiple from statements with left joins but the query returned fewer than the expected 8 results. That query builder looks something like this:

```
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select(array(
    'a', 'artist', 'country', 
    't', 'artwork', 'user'))
   ->from('AcmeArtworkBundle:Artwork', 'a')
   ->from('AcmeTourBundle:Tour', 't')
   ->leftJoin('a.artist', 'artist')
   ->leftJoin('a.country', 'country')
   ->leftJoin('t.artwork', 'artwork')
   ->leftJoin('t.user', 'user')
   ->where('a.featured = true')
   ->andWhere('t.featured = true')
   ->orderBy('a.sticky', 'DESC')
   ->addOrderBy('t.sticky', 'DESC')
   ->addOrderBy('a.weight', 'ASC')
   ->addOrderBy('t.weight', 'ASC')
   ->setFirstResult($offset)
   ->setMaxResults($limit);

// 5 results :-(

```

Answer: 
Better to use FQL in this case. More suited to this type of nested question.

```
select uid, rsvp_status from event_member where eid = <EVENT_ID> and uid IN (SELECT uid2 from friend where uid1 = me())

```

That will return all friends of the person logged in who are attending the event you specify.
The accepted answer doesn't work anymore, as facebook no longer allows event attendee requests without one of the event admins' access keys [(see Graph api reference)](https://developers.facebook.com/docs/graph-api/reference/event/attending/). As they also [removed the option](https://stackoverflow.com/questions/24640306/what-is-the-replacement-for-friends-events-permission-in-fb-graph-api-v2-0) to access friends' events for privacy reasons, there is currently no way of doing this solely via the Graph API