title: doctrine: many to many relation with join table: how to add WHERE condition
body: <p>I have three tables:</p>
  
  <pre><code>Clients: (id, name, ...)
  
  Files: (id, filename, type, data)
  </code></pre>
  
  <p>and join table:</p>
  
  <pre><code>Clients2Files (id, id_clients, id_files, created_at, deleted_at)
  </code></pre>
  
  <p>in php class Clients I want to get access to all client's files, but only to the files that hasn't been deleted (in sql speak WHERE deleted_at IS NULL)</p>
  
  <p>Now I have code like this (in entity class Client), which selects all (even deleted) files:</p>
  
  <pre class="lang-php prettyprint-override"><code>/**                                                                         
  * @ManyToMany(targetEntity="File")                                          
  * @JoinTable(name="Clients2Files",                                  
  *      joinColumns={@JoinColumn(name="id_clients", referencedColumnName="id")},
  *      inverseJoinColumns={@JoinColumn(name="id_files", referencedColumnName="id")}
  *      )                                                                    
  */                                                                          
  private $files;              
  </code></pre>
  
  <p>How can I add condition <code>WHERE deleted_at IS NULL</code> to this doctrine code? To select only files that are not "deleted".</p>