1

I already have an $event->attendees with some existing attendees. I would like to add new EventAttendee to this event but it looks like my code crushes the old attendees list.

I try

$attendeesx= $event->getAttendees();
$attendees = array_push($attendeesx,$newattendee);
$event->attendees = $attendees;
$service->events->update(MyCalendar, $event->getID(), $event);

not working. Anyway I would like to add, not replace the old list by a new one. Any clue?

What is additionalGuest? What is it made for?

orde
  • 5,233
  • 6
  • 31
  • 33
gdem
  • 15
  • 4

1 Answers1

0

array_push($attendeesx,$newattendee) modifies the $attendeesx in place. Than means the return value (which is an int) really should not be assigned to $attendees.

Also event has a setter for attendees, why not use that? ;)

luc
  • 3,642
  • 1
  • 18
  • 21
  • 1
    The setter is erasing the existing attendees to put new ones instead. what I am looking for is an addattendee and removeattendee where all the existing attendees with their caracteristics are kept safe and the new one added or some of the existing attendees removed. If you are aware of a way to do this... thks – gdem Oct 01 '14 at 06:32
  • array_push($attendeesx,$newattendee) is correct. Just don't assign the result anywhere as $attendeesx will already contain what you want. – luc Oct 01 '14 at 20:59