title: Rearranging active record elements in Yii
body: <p>I am using a CDbCriteria with its own conditions, with &amp; order clauses. However, the order i want to give to the elements in the array is way too complex to specify in the order clause.</p>
  
  <p>The solution i have in mind consists of obtaining the active records with the defined criteria like this</p>
  
  <pre><code>$theModelsINeed = MyModel::model()-&gt;findAll($criteria); 
  </code></pre>
  
  <p>and then rearrange the order from my php code. How can i do this? I mean, i know how to iterate through its elements, but i don´t know if it is possible to actually change them. </p>
  
  <p>I have been looking into <a href="http://www.yiiframework.com/doc/api/1.1/CActiveRecord#populateRecord-detail" rel="nofollow">this</a> link about populating active records, but it seems quite complicated and maybe someone could have some better advice.</p>
  
  <p>Thanks</p>