title: Query to find where associated model (has many) is empty in cakephp
body: <p>I have a model named <code>Application</code>. And <code>Application</code> is associated to <code>has_many</code> model named <code>Location</code>.</p>
  
  <p><code>Application</code> has many <code>Location</code></p>
  
  <p>In my Application query:</p>
  
  <pre><code>$this-&gt;Application-&gt;find('all', array('conditions' =&gt; 'Application.status' =&gt; 'accepted'));
  </code></pre>
  
  <p>I'm finding <code>applications</code> where <code>status</code> is <code>accepted</code>.</p>
  
  <p>Next thing that I would like to achieve is to find <code>Application</code> records where associated <code>Location</code> is empty/null or in other words where <code>count</code> of <code>Location</code> records is 0.</p>
  
  <p>I tried to make <code>join</code> query like this:</p>
  
  <pre><code> $join_query = array(
              'table' =&gt; 'locations',
              'alias' =&gt; 'Location',
              'type' =&gt; 'INNER',
              'conditions' =&gt; array(
                  'Location.application_id = Application.id',
                  'OR' =&gt; array(
                      array('Location.id' =&gt; NULL)
                  )
              )   
          );
  </code></pre>
  
  <p>But seems like it's just querying <code>Application</code> records that do have associated <code>Location</code> records.</p>
  
  <p>Thanks in advanced if you guys have any idea(s).</p>