我的代码是:
$criteria = new MyCDbCriteria;
$criteria->select = 't.id, acc.server_account, t.registration_date, lac.login, t.summ, t.input, t.output, t.lot, t.options_sum, t.profit';
$criteria->join = 'join `accounts` acc on (t.account_id = acc.id) join `users` u on (acc.user_id = u.id) join `leads_and_clients` lac on (u.login = lac.login)';
$records = PartnersReport::model()->findAll($criteria);
foreach ($records as $record) {
foreach ($record->attributes as $key => $val) {
$return['values'][$record->id][$key] = $val;
}
}
问题:没有"加入" server_account
中的$record->attributes
等属性。如何添加?
答案 0 :(得分:0)
创建一个属性PartnersReport :: server_account并将其用作SELECT中的别名:
$ criteria-> select =' t.id,acc.server_account AS server_account,t.registration_date,lac.login,t.summ,t.input,t.output,t.lot,t。 options_sum,t.profit';