• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/sync/managers/connectionmanager.php
  • Класс: BitrixCalendarSyncManagersConnectionManager
  • Вызов: ConnectionManager::createConnection
protected function createConnection(
	Role $owner,
	string $type,
	string $name,
	string $serverPath
): Connection
{
	$fields = [
		'ENTITY_TYPE' => $owner->getType(),
		'ENTITY_ID' => $owner->getId(),
		'ACCOUNT_TYPE' => $type,
		'NAME' => $name,
		'SERVER' => $serverPath,
	];
	if ($connectionId = CDavConnection::Add($fields))
	{
		return $this->mapperFactory->getConnection()->getById($connectionId);
	}

	throw new BaseException('Error of create new Dav connection');
}