CDbCriteria
我通过我的代码 在模型中加入了一些表格,如下所示:
$crt = new CDbCriteria();
$crt->alias = 'so';
$crt->select = 'u.id, u.first_name, u.last_name';
$crt->join = " inner join " . Flow::model()->tableName() . " as fl on fl.id = so.flow_id";
$crt->join .= " inner join " . RoleUser::model()->tableName() . " as ru on ru.id = fl.receiver_role_user_id";
$crt->join .= " inner join " . User::model()->tableName() . " as u on ru.user_id= u.id";
$crt->compare('sms_outbox_group_id', $smsOutboxGroupId);
$crt->compare('fl.kind', Flow::KIND_SMS);
$crt->group = 'u.id';
$smsOutBox = new SmsOutbox();
return new CActiveDataProvider($smsOutBox, array(
'criteria' => $crt,
'sort' => array(
'defaultOrder' => 'so.id DESC',
)
));
如何在中显示我选择的列CGridView
?有没有可能的方法来显示first_name
而不last_name
定义模型中的关系?