Sort in Data Provider

I am trying to load a resultset in a nice single tidy line:


             $fees=Fees::model()->search()->getData();



this works just fine. Now I want this to be ordered - is something like the following possible?


             $fees=Fees::model()->search()->setSort(array('defaultOrder'=>'min_amount'))->getData();



Well, you can either overwrite your model’s defaultScope(), add another scope and call it via with() or set CDbCriteria.order within your model’S search() method.

This may work (store MyActiveDataProvider.php in protected/components, change model search() to instantiate MyActiveDataProvider)




<?php>

class MyActiveDataProvider extends CActiveDataProvider

{

  public function setSort($value)

  {

    parent::setSort($value);

    return $this;

  }

}



(untested)

/Tommy