public function testChangeInvitationStatus()
 {
     $availableStatuses = [CalendarEvent::ACCEPTED, CalendarEvent::TENTATIVELY_ACCEPTED, CalendarEvent::DECLINED];
     foreach ($availableStatuses as $status) {
         $calendarEventId = $this->calendarEvent->getId();
         $this->client->request('GET', $this->getUrl('oro_calendar_event_' . $status, ['id' => $calendarEventId, 'status' => $status]));
         $response = $this->client->getResponse();
         $data = json_decode($response->getContent(), true);
         $this->assertTrue($data['successful']);
         $calendarEvent = $this->getCalendarEventByTitle(LoadCalendarEventData::CALENDAR_EVENT_TITLE);
         $this->assertEquals($status, $calendarEvent->getInvitationStatus());
     }
 }
 /**
  * "Success" form handler
  *
  * @param CalendarEvent   $entity
  * @param ArrayCollection $originalChildren
  * @param boolean         $notify
  */
 protected function onSuccess(CalendarEvent $entity, ArrayCollection $originalChildren, $notify)
 {
     $new = $entity->getId() ? false : true;
     $this->manager->persist($entity);
     $this->manager->flush();
     if ($new) {
         $this->emailSendProcessor->sendInviteNotification($entity);
     } else {
         $this->emailSendProcessor->sendUpdateParentEventNotification($entity, $originalChildren, $notify);
     }
 }
 /**
  * @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];
 }
 /**
  * @Route("/update/{id}", name="oro_calendar_event_update", requirements={"id"="\d+"})
  * @Template
  * @Acl(
  *      id="oro_calendar_event_update",
  *      type="entity",
  *      class="OroCalendarBundle:CalendarEvent",
  *      permission="EDIT",
  *      group_name=""
  * )
  */
 public function updateAction(CalendarEvent $entity)
 {
     $formAction = $this->get('router')->generate('oro_calendar_event_update', ['id' => $entity->getId()]);
     return $this->update($entity, $formAction);
 }