CActiveFinder help needed.

hello all,

i am trying to work on querying database with best performance so i decided to use CActiveFinder but there isn’t any examples around. can anyone help me on how to implement CActiveFinder? is it the same way as CActiveRecord? because CActiveFinder don’t implements CModel so i have no idea how to use and implement.

thanks in advanced.

As CActiveRecord uses CActiveFinder internally, and the overhead is really acceptable if you have a well-written backend, using finder in your controllers is discouraged.

If you want to achieve maximum performance, you may want to use DAO instead.

thank you very much.

oh i have another question. why i am unable to retrieve record count with




$criteria=new CDbCriteria();

$criteria->condition='deleted_time=:deleted';

$criteria->order='name ASC';

$criteria->params=array(':deleted'=>'0000-00-00 00:00:00');


Category::model()->with('user')->count($criteria);



for ‘user’




public function relations()

{

  return array(

   'user'=>array(

     self::MANY_MANY,

     'user',

     'usercategory(user_id,category_id)',

     'condition'=>'??.id='.Yii::app()->user->id),

   ),

  );

}



thanks alot…