php - Yii CActiveDataProvider generate SQL query -
cactivedataprovider
generating auto query count total item count:
select count(distinct `t`.`id`) `transaction` `t` left outer join `partner` `partner` on (`t`.`partner_id`=`partner`.`id`)
this query slow, because contain join, how can set manualy total count, , disable auto query ?
you may manualy set total item count cactivedataprovider prevent auto calculation.
class model extends cactiverecord { public function search(){ $criteria = new cdbcriteria; // criteria here $data_provider = new cactivedataprovider($this, array('criteria'=>$criteria)); // replace $this->count( $criteria ) own condition or criteria $data_provider->settotalitemcount( $this->count( $criteria ) ); return $data_provider; } }
Comments
Post a Comment