title: Yii order by another table with has_many relation
body: <p>I have this Object model with 'has_many' relation to Variables</p>
  
  <pre><code>public function relations()
  {
      return array(
          'variables' =&gt; array(self::HAS_MANY, 'Variables', 'variable_id')
      );
  }
  </code></pre>
  
  <p>Now i want to use the variables to order my data like</p>
  
  <pre><code>$criteria-&gt;with = array('variables');
  
  $criteria-&gt;order = 'variables.id DESC';
  </code></pre>
  
  <p>But it doesn't work.</p>
  
  <p>Is there a way to do something like this? Thanks.</p>