title: TypeORM - Many-to-Many where clause on join table
body: <p>I'm using <code>Typeorm@0.2.5</code> with MySql driver.<br>
  I have an entity, <code>MyEntity</code>, which has a many-to-many relationship with another entity, <code>RelEntity</code>. Therefore Typeorm generates a pivot table of the PKs to create the relationship.</p>
  
  <p>My problem comes from the need to find all <code>MyEntity</code> using a where clause of <code>RelEntity.prop = mySearchKey</code>.</p>
  
  <p>I'm not sure if this is down to me missing some documentation or not fully understanding how to structure this query withing Typeorm.</p>
  
  <p>I believe my SQL statement for this would look something like:</p>
  
  <pre><code>SELECT m.* FROM my_entity_table m 
  LEFT JOIN my_rel_pivot_table mrp ON mrp.my_entity_id = m.id 
  LEFT JOIN rel_entity_table r ON r.id = mrp.rel_entity_id
  WHERE r.id = {MY_VALUE_HERE}
  </code></pre>
  
  <p>However, I'm not too sure how to translate this into a Typeorm query.</p>
  
  <p>I have tried:</p>
  
  <pre><code>this.entityRepo.find({
      where: {
          rel: myValue
      }
  });
  </code></pre>
  
  <p>I have also tried:</p>
  
  <pre><code>this.entityRepo.find({
      where: {
          rel: { id: myValue}
      }
  });
  </code></pre>
  
  <p>However, I received the following error:<br>
  <code>Unknown column 'MyEntity.myEntityId' in 'where clause'</code></p>
  
  <p>Has anyone encountered this issue before, or have any idea how to solve this?</p>