Example #1
0
 /**
  * Send respond notification to event creator from invitees
  *
  * @param CalendarEvent $calendarEvent
  * @throws \LogicException
  */
 public function sendRespondNotification(CalendarEvent $calendarEvent)
 {
     if ($calendarEvent->getParent()) {
         switch ($calendarEvent->getInvitationStatus()) {
             case CalendarEvent::ACCEPTED:
                 $templateName = self::ACCEPTED_TEMPLATE_NAME;
                 break;
             case CalendarEvent::TENTATIVELY_ACCEPTED:
                 $templateName = self::TENTATIVE_TEMPLATE_NAME;
                 break;
             case CalendarEvent::DECLINED:
                 $templateName = self::DECLINED_TEMPLATE_NAME;
                 break;
             default:
                 throw new \LogicException(sprintf('Invitees try to send un-respond status %s', $calendarEvent->getInvitationStatus()));
         }
         $this->addEmailNotification($calendarEvent, $this->getParentEmail($calendarEvent), $templateName);
         $this->process();
     }
 }
Example #2
0
 /**
  * @param CalendarEvent $calendarEvent
  * @param string        $status
  */
 protected function setDefaultEventStatus(CalendarEvent $calendarEvent, $status = CalendarEvent::NOT_RESPONDED)
 {
     if (!$calendarEvent->getInvitationStatus()) {
         $calendarEvent->setInvitationStatus($status);
     }
 }
 /**
  * @param CalendarEvent $event
  *
  * @return array
  */
 protected function serializeCalendarEvent(CalendarEvent $event)
 {
     return ['id' => $event->getId(), 'title' => $event->getTitle(), 'description' => $event->getDescription(), 'start' => $event->getStart(), 'end' => $event->getEnd(), 'allDay' => $event->getAllDay(), 'backgroundColor' => $event->getBackgroundColor(), 'createdAt' => $event->getCreatedAt(), 'updatedAt' => $event->getUpdatedAt(), 'invitationStatus' => $event->getInvitationStatus(), 'parentEventId' => $event->getParent() ? $event->getParent()->getId() : null, 'calendar' => $event->getCalendar() ? $event->getCalendar()->getId() : null];
 }