• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/sync/factories/factoriescollection.php
  • Класс: BitrixCalendarSyncFactoriesFactoriesCollection
  • Вызов: FactoriesCollection::createBySectionId
static function createBySectionId(Section $section, array $availableService = null): FactoriesCollection
{
	$collection = [];

	if (!Loader::includeModule('dav'))
	{
		return new self($collection);
	}
	// $links = self::getLinks($section, $availableService);
	$links = SectionConnectionTable::query()
		->setSelect(['*', 'CONNECTION'])
		->addFilter('=SECTION_ID', $section->getId())
		->addFilter('=CONNECTION.IS_DELETED', 'N')
	;

	if ($availableService)
	{
		$links->addFilter('ACCOUNT_TYPE', $availableService);
	}

	$queryResult = $links->exec();

	while ($link = $queryResult->fetchObject())
	{
		$connection = (new SyncBuildersBuilderConnectionFromDM($link->getConnection()))->build();
		$sectionConnection = (new SyncBuildersBuilderSectionConnectionFromDM($link))->build();

		$context = self::prepareContextForSection($connection, $sectionConnection, $section);

		$collection[] = FactoryBuilder::create(
			$connection->getVendor()->getCode(),
			$connection,
			$context
		);
	}

	return new self($collection);
}