Add vevent object on a vcalendar object (Combine multiple ics file)

46 views
Skip to first unread message

Alexis Piéplu

unread,
Sep 1, 2016, 4:04:22 PM9/1/16
to SabreDAV Discussion
Hi!

I would like combine multiple .ics file with sabre VObject. And I'm not sur if it's possible on that way:

$calendarsArray is an simple array of content of .ics files

$globalVCalendar = new VObject\Component\VCalendar();

foreach($calendarsArray as $value){
      $anCalendar
= VObject\Reader::read($value);
     
//$nameCalendar = $anCalendar
     
foreach($anCalendar->VEVENT as $event) {
        $globalVCalendar
->add('VEVENT', $event); // ERRORS, need array
     
}
}

Can we add vevent object on a vcalendar? (I don't found that on the doc) The good way is it to transform the vevent objet to an array ? (If it's easy) Or other ?

Thanks in advance!

Evert Pot

unread,
Sep 1, 2016, 4:51:11 PM9/1/16
to SabreDAV Discussion

Try:

$globalVCalendar->add($event);


Evert

Alexis Piéplu

unread,
Sep 4, 2016, 7:12:39 PM9/4/16
to SabreDAV Discussion
Thanks!

I don't understand why, but it did't work the first time I test it...
Reply all
Reply to author
Forward
0 new messages