title: Doctrine DQL QueryBuilder Excluding Entities where relationship exists
body: <p>I have two entites</p>
  
  <pre><code>Order
    oneToMany:
      statuses:
         targetEntity: \Status
         mappedBy: order
  
  Status
    manyToOne:
      order:
        targetEntity: \Order
        inversedBy: status
    fields:
      code:
        type:integer
  </code></pre>
  
  <p>As you can see - one order can have more that one status at a time (statuses like 'has been shipped', 'has been paid for etc.').</p>
  
  <p>I want to write a query that fetch all my Orders that do NOT have a status of 6.
  I'm finding it hard to get my head round this.</p>
  
  <p>Assume that I have three orders. The all have a status of '1' (new), and ONE of those orders  additionally has a status of '6' (under review). I want to retrieve only the two orders that do NOT have a status of 6.</p>
  
  <p>Writing the query like so..</p>
  
  <pre><code>$qb-&gt;select('o')
      -&gt;from('MyOrderBundle:Order', 'o')
      -&gt;innerJoin('o.statuses', 'st')
      -&gt;where(
      $qb-&gt;expr()-&gt;not(
          $qb-&gt;expr()-&gt;eq('st.code', 6)
          )
  );
  </code></pre>
  
  <p>Excludes the status row of 6 from the SQL generated, but still includes the order in the result set (because the status row where the code=1 matches the condition of not being equal to 6). I need to be able to say "Exclude from my result set any entity that has an association like {something}". Is there a DQL keyword that can help me here?</p>
  
  <p>-Cross posting on the doctrine user group and will update answers In both place if I find a solution.</p>