0
在公司模型中,我加入了模型user和business_unit。如何獲取YII中CDbCriteria的連接屬性?
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id);
$criteria->compare('status',$this->status);
$criteria->condition = "`t`.status = '1'";
$criteria->order = 'created DESC';
$criteria->join = " inner join users on users.company_id = `t`.id";
$criteria->condition = "`t`.status = '1'";
$criteria->order = 'created DESC';
$criteria->join = " inner join business_unit on business_unit.company_id = `t`.id";
它的工作原理。但我得到的只有公司attributes.How我得到business_unit
和users
屬性以及屬性company
謝謝它的工作原理...更多的事情是如何獲得嵌套連接屬性 –
在foreach循環每個關係(因爲關係是has_many) –