title: cakephp - order by a field in the contained Model
body: <p>I'm trying to get all the products which are in a particular category (products hasandbelongstomany Catrgories). My conditions are the Category.name='whatever' and the Product.live=1 </p>
  
  <p>I can do this like this:  </p>
  
  <pre><code>$cats = $this-&gt;Category-&gt;find('all', array(
      'conditions' =&gt; array(
          'Category.name' =&gt; $categoryName
      ),
      'contain' =&gt; 'Product.live = 1'
  ));
  </code></pre>
  
  <p>But I also want to sort the results by Product.sort_order, so I tried:</p>
  
  <pre><code>$cats = $this-&gt;Category-&gt;find('all', array(
      'conditions' =&gt; array(
          'Category.name' =&gt; $categoryName
      ),
      'order' =&gt; array('Product.sort_order'),
      'contain' =&gt; 'Product.live = 1'
  ));
  </code></pre>
  
  <p>But this doesn't work. Whats the correct way to do this?</p>