title: Building conditional statement across multiple models (CakePHP 1.2.5)
body: <p>Let's say I have 3 models: User, Region, Country.</p>
  
  <pre><code>User belongsTo Region
  Region belongsTo Country
  </code></pre>
  
  <p>Each of these models is using the Containable behavior.  I'm attempting to find users from the country with code 'US'.  Here's what I'm attempting:</p>
  
  <pre><code>$users = $this-&gt;User-&gt;find('all', array(
      'conditions' =&gt; array('Country.code' =&gt; 'US'),
      'contain'    =&gt; array('Region.Country'),
  ));
  </code></pre>
  
  <p>CakePHP is separating this into 2 queries:</p>
  
  <ol>
  <li>First, it is SELECTing the ID's for all countries with code 'US'.</li>
  <li>Then it is using those ID's to SELECT all users JOINing regions where <code>region.country_id</code> is in that list of country ID's previously retrieved.</li>
  </ol>
  
  <p>As a result, I end up with SQL errors in my app since my <code>conditions</code> array contains a reference to Country.code, and the second query that Cake builds doesn't JOIN countries.</p>
  
  <p>The best Cake solution I see is to build a sub-query as described in the <a href="http://book.cakephp.org/view/74/Complex-Find-Conditions" rel="nofollow noreferrer">Complex Find Conditions</a> portion of the manual.  However, this seems very convoluted, and is more of a hack than I would like to implement.  Is there an easier way that I'm overlooking?</p>