Hi, I’m wondering how to get the column values from related models when you do a relational query.
For example, suppose I have the following in a controller:
$qdbs_admin = QuoteDb::model()->with(array(
'qdb_admins'
))->findAll(array('condition'=>'qdb_admins.user_id = ' . Yii::app()->user->id));
and then loop that data into an array:
$qdbs_admin_list = array();
$i = 0;
foreach($qdbs_admin as $qdb_admin)
{
$qdbs_admin_list[$i] = $qdb_admin->attributes;
$i++;
}
The "attributes" value only gets the column values from the primary table (in this case, the table for QuoteDb).
I have also defined the connections between the models in the relations() function in each model file. How would I go about getting column values of related tables in a single relational query?