• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/sync/factories/eventconnectionfactory.php
  • Класс: BitrixCalendarSyncFactoriesEventConnectionFactory
  • Вызов: EventConnectionFactory::getEventConnection
public function getEventConnection(array $params): ?EventConnection
{
	if (!Loader::includeModule('dav'))
	{
		return null;
	}

	$select = ['*'];
	if (empty($params['event']))
	{
		$select[] = 'EVENT';
	}
	if (empty($params['connection']))
	{
		$select[] = 'CONNECTION';
	}

	$statement = EventConnectionTable::query();
	$statement->setSelect($select);
	if (!empty($params['filter']))
	{
		$statement->setFilter($params['filter']);
	}

	$link = $statement->exec()->fetchObject() ?: null;
	if ($link === null)
	{
		return null;
	}

	$event = $params['event']
		?? (new EventBuilderFromEntityObject($link->getEvent()))->build();

	$connection = $params['connection']
		?? (new BuilderConnectionFromDM($link->getConnection()))->build();

	$result = new EventConnection();
	$result
		->setId($link->getId())
		->setEvent($event)
		->setConnection($connection)
		->setVendorEventId($link->getVendorEventId())
		->setLastSyncStatus($link->getSyncStatus())
		->setEntityTag($link->getEntityTag())
		->setVersion($link->getVersion())
		->setData($link->getData())
	;

	return $result;
}