• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/sync/factories/sectionconnectionfactory.php
  • Класс: BitrixCalendarSyncFactoriesSectionConnectionFactory
  • Вызов: SectionConnectionFactory::prepareLink
private function prepareLink(
	EO_SectionConnection $link,
	?Connection $connection = null,
	?Section $section = null
): SectionConnection
{
	if ($connection === null)
	{
		$connection = $this->mapperFactory->getConnection()->getById($link->getConnectionId());
	}
	$section = $section
		?? ($link->getSection()
			? $this->buildSection($link->getSection())
			: null
		);
	if ($section === null)
	{
		$section = $this->mapperFactory->getSection()->getById($link->getSectionId());

		if (!$section)
		{
			throw new BaseException('Section not found');
		}

	}

	$item = new SectionConnection();
	$item
		->setId($link->getId())
		->setSection($section)
		->setConnection($connection)
		->setVendorSectionId($link->getVendorSectionId())
		->setSyncToken($link->getSyncToken())
		->setPageToken($link->getPageToken())
		->setActive($link->getActive())
		->setLastSyncDate(new CoreBaseDate($link->getLastSyncDate()))
		->setLastSyncStatus($link->getLastSyncStatus())
		->setVersionId($link->get('VERSION_ID'))
	;

	return $item;
}