• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/discount/runtimecache/discountcache.php
  • Класс: BitrixSaleDiscountRuntimeCacheDiscountCache
  • Вызов: DiscountCache::getDiscountEntities
public function getDiscountEntities(array $discountIds)
{
	if(empty($discountIds))
	{
		return array();
	}
	Collection::normalizeArrayValuesByInt($discountIds);
	if(empty($discountIds))
	{
		return array();
	}

	$cacheKey = 'D' . implode('_', $discountIds);
	if (!isset($this->discountEntities[$cacheKey]))
	{
		$needToLoad = $discountIds;
		$resultEntities = array();

		foreach ($this->discountEntities as $data)
		{
			list($loadedDiscountIds, $entities) = $data;

			$needToLoadPortion = array_diff($needToLoad, $loadedDiscountIds);

			if (count($needToLoad) > count($needToLoadPortion))
			{
				$resultEntities = array_merge($resultEntities, $entities);
			}

			$needToLoad = $needToLoadPortion;
			if (empty($needToLoad))
			{
				break;
			}
		}

		if (!empty($needToLoad))
			self::recursiveMerge($resultEntities, DiscountEntitiesTable::getByDiscount($needToLoad));

		$this->discountEntities[$cacheKey] = array($discountIds, $resultEntities);
	}
	return $this->discountEntities[$cacheKey][1];
}