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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -