• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/propertyindex/querybuilder.php
  • Класс: BitrixIblockPropertyIndexQueryBuilder
  • Вызов: QueryBuilder::getPropertyCodeMap
private function getPropertyCodeMap(): array
{
	$result = [];

	$iterator = BitrixIblockPropertyTable::getList([
		'select' => [
			'ID',
			'CODE',
		],
		'filter' => [
			'=IBLOCK_ID' => $this->facet->getIblockId(),
		],
	]);
	while ($row = $iterator->fetch())
	{
		$id = (int)$row['ID'];
		$result[$id] = $id;
		$row['CODE'] = (string)$row['CODE'];
		if ($row['CODE'] !== '')
		{
			$result[$row['CODE']] = $id;
		}
	}
	unset($iterator);

	$skuIblockId = $this->facet->getSkuIblockId();
	if ($skuIblockId > 0)
	{
		$iterator = BitrixIblockPropertyTable::getList([
			'select' => [
				'ID',
			],
			'filter' => [
				'=IBLOCK_ID' => $skuIblockId,
			],
		]);
		while ($row = $iterator->fetch())
		{
			$id = (int)$row['ID'];
			$result[$id] = $id;
		}
		unset($iterator);
	}

	return $result;
}