I have a method in an ActiveRecord data model
…
$criteria = new CDbCriteria;
$criteria->join = ‘JOIN bounce.tracking_clicks AS tc ON t.click_id = tc.click_id JOIN bounce.tracking ON tracking.tracking_id = tc.tracking_id’;
$criteria->condition = “$date >= ‘{$from}’ AND $date < ‘{$to}’”;
…
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria, ));
the problem is when I pass this to gridview, all the fields are from this table, I want all the fields from other two tables. they are not here.
I checked weblog, the query is like this:
Querying SQL: SELECT COUNT(*) FROM ThreadSaleTracker
t
JOIN
bounce.tracking_clicks AS tc ON t.click_id = tc.click_id
JOIN bounce.tracking ON tracking.tracking_id = tc.tracking_id
WHERE (trans_post_date >= ‘2010-06-02’ AND trans_post_date < '2010-06-02
23:59:59’) AND (adtrack_source = ‘google’)
It works fine if I run it on mysql command line and everything got returned including other two tables.
Did I miss something, how come the query has everything $data from CActiveDataProvider doesn’t have all fields
Appreciate all helps