Please, how can I do this using tb_broadcast::model()->findAll()?
I don’t know how to join the two tables :s
$rs=Yii::app()->db->createCommand()
->select('B.id_broadcast,B.id_channel,B.id_spot,S.id_tp_spot')
->from('tb_broadcast as B, tb_spot as S')
->where('B.id_spot=S.id_spot AND B.fc_delete IS NULL')
->queryAll();
$rs = tb_broadcast::model()->with('idSpot')->together()->findAll();
// now access attributes like this:
foreach($rs as $<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='B)' /> {
echo $b->id_broadcast;
echo $b->id_channel;
echo $b->id_spot;
echo $b->idSpot->id_tp_spot; // you can access the relations attribute via the defined relation
}