• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/v2/Property/PropertyRepository.php
  • Класс: BitrixCatalogv2PropertyPropertyRepository
  • Вызов: PropertyRepository::loadCollection
protected function loadCollection(array $entityFields, BaseIblockElementEntity $parent): PropertyCollection
{
	$propertySettings = [];

	if ($parent instanceof HasSectionCollection)
	{
		$linkedPropertyIds = $this->getLinkedPropertyIds($parent->getIblockId(), $parent);
		if (!empty($linkedPropertyIds))
		{
			$propertySettings = $this->getPropertiesSettingsByFilter([
				'@ID' => $linkedPropertyIds,
			]);
		}
	}
	else
	{
		// variation properties don't use any section links right now
		$propertySettings = $this->getPropertiesSettingsByFilter([
			'=IBLOCK_ID' => $parent->getIblockId(),
		]);
	}

	$collection = $this->createCollection();

	foreach ($propertySettings as $settings)
	{
		$fields = $entityFields[$settings['ID']] ?? [];
		$settings['IBLOCK_ELEMENT_ID'] = $parent->getId();
		$property = $this->createEntity($fields, $settings);

		$collection->add($property);
	}

	return $collection;
}