hi,
i have a table EVENT and HASPICTUREGALLERY.
no i want to show all events and their galleries (if there were added some to the event)
works fine, but it only returns the events which have ONE or more galleries attached. But i want also those without a gallery attached.
in my Event Model:
public function relations() {
return array(
'attached_galleries' => array(self::HAS_MANY, 'HasPictureGallery', 'table_item_id',
'condition' => "table_prefix = 'event'",
'with' => 'gallery_infos',)
);
}
in my controler i get the events like this:
$events = Events::model()->with('attached_galleries')->findAll(array('order' => 'date_start ASC',
'condition' => 'YEAR(date_start) = ' . date("Y") . ' AND date_end >= NOW()'));
i have 4 events in the event table without a galery and 1 event with a gallery attached. it only shows me the one with the gallery. why?