• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/sync/handlers/synceventmergehandler.php
  • Класс: BitrixCalendarSyncHandlersSyncEventMergeHandler
  • Вызов: SyncEventMergeHandler::prepareReminders
private function prepareReminders(Event $localEvent, Event $externalEvent): ?CoreEventPropertiesRemindCollection
{
	$localRemindCollection = $localEvent->getRemindCollection();
	$externalRemindCollection = $externalEvent->getRemindCollection();
	if (!$externalRemindCollection || $externalRemindCollection->count() === 0)
	{
		if ($localRemindCollection)
		{
			// if reminders count more than one, we don't know which reminder was deleted,
			// and leave all of them
			return ($localRemindCollection->count() > 1)
				? $localEvent->getRemindCollection()
				: null
				;
		}
		else
		{
			return null;
		}
	}

	if ((!$localRemindCollection || $localRemindCollection->count() < 2))
	{
		return $externalEvent->getRemindCollection()->setSingle(false);
	}
	else
	{
		if ($externalRemindCollection->isSingle())
		{
			$this->removeClosestRemind($localRemindCollection);
			$localRemindCollection->add($externalRemindCollection->fetch());
			return $localRemindCollection;
		}
		else
		{
			return $this->mergeRemindCollections(
				$externalRemindCollection,
				$localRemindCollection,
			);
		}
	}
}