getCalendar()) { return; } $calendarRange->preventEnqueueChanges = true; $this->logger->info(self::class.' remove a calendar range because deleted on remote calendar'); $this->em->remove($calendarRange); break; case 'updated': try { $new = $this->machineHttpClient->request( 'GET', $notification['resource'] )->toArray(); } catch (ClientExceptionInterface $clientException) { $this->logger->warning(self::class.' could not retrieve event from ms graph. Already deleted ?', [ 'calendarRangeId' => $calendarRange->getId(), 'remoteEventId' => $notification['resource'], ]); throw $clientException; } $lastModified = RemoteEventConverter::convertStringDateWithTimezone($new['lastModifiedDateTime']); if ($calendarRange->getRemoteAttributes()['lastModifiedDateTime'] === $lastModified->getTimestamp()) { $this->logger->info(self::class.' change key is equals. Source is probably a local update', [ 'calendarRangeId' => $calendarRange->getId(), 'remoteEventId' => $notification['resource'], ]); return; } $startDate = RemoteEventConverter::convertStringDateWithoutTimezone($new['start']['dateTime']); $endDate = RemoteEventConverter::convertStringDateWithoutTimezone($new['end']['dateTime']); $calendarRange ->setStartDate($startDate)->setEndDate($endDate) ->addRemoteAttributes([ 'lastModifiedDateTime' => $lastModified->getTimestamp(), 'changeKey' => $new['changeKey'], ]) ->preventEnqueueChanges = true; break; default: throw new \RuntimeException('This changeType is not suppored: '.$notification['changeType']); } } }