Question: I'm using Doctrine 2 to try and do a query with an inner join. I have a Site entity and a Page entity. Each Site can have many pages and each page can only belong to one site. I have a site\_id foreign key in my pages table rows. In my Site entity, I've created a OneToMany assocatiion where the target entity is my Page entity and the mappedBy is set to Site. 

```
/**
 * @var \Doctrine\Common\Collections\ArrayCollection
 * @OneToMany(targetEntity="Page", mappedBy="Site", cascade={"persist", "remove"})
 */
private $pages;

```

In my Page entity, I have a ManyToOne association where the target entity is set to Site. 

```
/**
 * @var App\Entity\Site
 * @ManyToOne(targetEntity="Site")
 */
private $site;

```

Here is my query builder statement where I'm passing a specific Site id:

```
$qb = $this->_em->createQueryBuilder();
$qb->select('s')
    ->from('App\Entity\Site', 's')
    ->innerJoin('s.pages', 'p')
    ->where('s.id = :id')
    ->setParameter('id', $id);

```

and here is the actual SQL I get back:

```
SELECT s0_.id AS id0, s0_.domain AS domain1 FROM sites s0_ INNER JOIN  WHERE s0_.id = ?

```

See how the INNER JOIN information is completely missing? Am I doing something wrong here or is this a problem with Doctrine 2?

Answer: 
You need to explicitly tell Doctrine to fetch those columns:

```
$qb->select('s', 'p')
   ->form(...)
   ->join(...) 

```
Figured it out. My mappedBy statement was incorrect in Site entity. I was pointing at "Site" when it should have been "site".