Return The Same Model Item Multiple Times With ->Findall

Hi.

I have a model Images, and another model ImagePlans which tells me for every Station which images I should display. For every Station I have four available image slots, and of course the same Image can be displayed several times.

To find which images I should display on the given station I do something like this in the Station model:


$cdb = new CDbCriteria;

$cdb->with = array(

    'relation_to_plan'=>array(

        'alias'=>"piani",

        'condition'=>'piani.station = :hs',

        'params'=>array(':hs'=>$this->id),

    ),  

);

$cdb->order = "piani.slot";

Images::model()->findAll($cdb);



So this should return ALL the images JOINED with the available slots.

In my case I have TWO different images, one on the first slot and the second on the remaining 3.

The executed query is correct, in fact if I run it in phpmyadmin it returns the correct result (4 rows), but the findAll just returns the TWO different models, while I need the second to be duplicated for two more times!

It’s like “group by” was selected, but the query doesn’t have this option!

How come? How can I return all my records?

Thanks

this is the query dumped in application.log:


SELECT `t`.`id` AS `t0_c0`, `t`.`catena` AS `t0_c1`, `t`.`hotspot` AS `t0_c2`, `t`.`link` AS `t0_c3`, `t`.`descrizione` AS `t0_c4`, `t`.`file` AS `t0_c5`, `t`.`data_modifica` AS `t0_c6`, `t`.`utente_modifica` AS `t0_c7`, `piani`.`id` AS `t1_c0`, `piani`.`catena` AS `t1_c1`, `piani`.`hotspot` AS `t1_c2`, `piani`.`slot` AS `t1_c3`, `piani`.`immagine` AS `t1_c4`, `piani`.`bloccata` AS `t1_c5`, `piani`.`bloccata_da_livello` AS `t1_c6` FROM `images` `t`  LEFT OUTER JOIN `image_pans` `piani` ON (`piani`.`immagine`=`t`.`id`)  WHERE (piani.hotspot = :hs) ORDER BY piani.slot. Bound with :hs='1'



it returns 4 rows.

the resulting array of Images models has just two items