title: Symfony 2.7 Doctrine don't mount query correctly
body: <p>I'm trying to get the classrooms from a teacher in a many to many relation.</p>
  <pre><code>$classrooms = $this-&gt;getDoctrine()-&gt;getManager()-&gt;getRepository('AppBundle:Classroom')-&gt;findBy(array('teachers' =&gt; $teacher));
  </code></pre>
  <p>But I get the error.
  The doctrine is not mounting the join:</p>
  <blockquote>
  <p>An exception occurred while executing 'SELECT t0.id AS id_1, t0.name AS name_2, t0.institution_id AS institution_id_3 FROM classroom t0 WHERE classroom_teacher.teacher_id = ?' with params [4]:</p>
  <p>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'classroom_teacher.teacher_id' in 'where clause'</p>
  </blockquote>
  <p>But I'm using the many to many</p>
  <p><strong>Class Classroom</strong></p>
  <pre><code>/**
   * Classroom
   *
   * @ORM\Table()
   * @ORM\Entity(repositoryClass=&quot;AppBundle\Repository\ClassroomRepository&quot;)
   */
  class Classroom
  {
      /**
       * @ORM\ManyToMany(targetEntity=&quot;Teacher&quot;, cascade={&quot;persist&quot;}, inversedBy=&quot;classrooms&quot;)
       */
      private $teachers;
      public function __construct()
      {
          $this-&gt;teachers         = new ArrayCollection();
      }
  }
  </code></pre>
  <p><strong>Class Teacher</strong></p>
  <pre><code>/**
   * Teacher
   *
   * @ORM\Table()
   * @ORM\Entity(repositoryClass=&quot;AppBundle\Repository\TeacherRepository&quot;)
   */
  class Teacher implements AdvancedUserInterface, \Serializable
  {
      /**
       * @ORM\ManyToMany(targetEntity=&quot;Classroom&quot;, mappedBy=&quot;teachers&quot;)
       */
      protected $classrooms;
      public function __construct()
      {
          $this-&gt;classrooms           = new ArrayCollection();
      }
  }
  </code></pre>
  <p>What is wrong?</p>