Example #1
0
 /**
  * Converts a Google Calendar Event Attendee object into a standard Attendee
  * object.
  *
  * @param \Google_Service_Calendar_EventAttendee $googleAttendee
  *
  * @return Attendee
  */
 private function createAttendeeObject(\Google_Service_Calendar_EventAttendee $googleAttendee, Event $event)
 {
     $attendee = new Attendee(['id' => $googleAttendee->getId(), 'name' => $googleAttendee->getDisplayName(), 'status' => $googleAttendee->getResponseStatus(), 'email' => $googleAttendee->getEmail(), 'comment' => $googleAttendee->getComment()]);
     $attendee->event = $event;
     $attendee->apiObject = $googleAttendee;
     return $attendee;
 }
Example #2
0
 /**
  * Fill data from google object into model
  *
  * @param \Google_Service_Calendar_EventAttendee $attendeeItem
  * @param \KevinDitscheid\KdCalendar\Domain\Model\Attendees $attendee
  *
  * @return \KevinDitscheid\KdCalendar\Domain\Model\Attendees
  */
 public static function convert($attendeeItem, $attendee = NULL)
 {
     $feUserRepository = self::getFrontendUserRepositoryInstance();
     $feUser = $feUserRepository->findByEmail($attendeeItem->getEmail())->getFirst();
     if ($feUser === NULL) {
         $feUser = new \TYPO3\CMS\Extbase\Domain\Model\FrontendUser();
         $feUser->setUsername($attendeeItem->getEmail());
         $feUser->setName($attendeeItem->getDisplayName());
         $feUser->setEmail($attendeeItem->getEmail());
         $feUserRepository->add($feUser);
         self::persist();
     }
     if ($attendee === NULL) {
         $attendee = new \KevinDitscheid\KdCalendar\Domain\Model\Attendees();
     }
     $attendee->setAdditionalGuests($attendeeItem->getAdditionalGuests());
     $attendee->setComment($attendeeItem->getComment());
     $attendee->setId($attendeeItem->getId());
     $attendee->setOptional($attendeeItem->getOptional());
     $attendee->setOrganizer($attendeeItem->getOrganizer());
     $attendee->setResource($attendeeItem->getResource());
     $attendee->setResponseStatus($attendeeItem->getResponseStatus());
     $attendee->setSelf($attendeeItem->getSelf());
     return $attendee;
 }