title: Doctrine relationship conditions
body: <p>I'm working on a Symfony2 project with an existing database.</p>
  
  <p>In the database there is different statuses, where each status has a type.
  E.G</p>
  
  <pre><code>status  |  type  |  description
     C         O       Completed
     C         G       Cancelled
  </code></pre>
  
  <p>Now I have an order entity, which joins with status entity.
  I only want join the orders where the status type is O.</p>
  
  <p>My current model looks like this:</p>
  
  <pre><code>/**
   * @ORM\ManyToOne(targetEntity="Statuses", inversedBy="orders")
   * @ORM\JoinColumn(name="status", referencedColumnName="status")
   */
  private $status;
  </code></pre>
  
  <p>How can I specify to join only on the type, so if an order has got a status of C, then I get the 'completed' status on the join and not the 'cancelled' one?</p>
  
  <p>Unfortunately I can't make any changes to the database structure, as there is other apps dependant on the structure.</p>