EntityPreset::getActiveItemList

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. EntityPreset
  4. getActiveItemList
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/entitypreset.php
  • Класс: Bitrix\Crm\EntityPreset
  • Вызов: EntityPreset::getActiveItemList
static function getActiveItemList()
{
	$results = [];

	if (isset(static::$staticCache[static::CACHE_ID_ACTIVE_ITEM_LIST]))
	{
		$results = static::$staticCache[static::CACHE_ID_ACTIVE_ITEM_LIST];
	}
	else
	{
		$cache = Cache::createInstance();
		if (
			$cache->initCache(
				static::CACHE_TTL,
				static::CACHE_ID_ACTIVE_ITEM_LIST,
				static::CACHE_PATH
			)
		)
		{
			$results = $cache->getVars();
		}
		elseif ($cache->startDataCache())
		{
			$entity = self::getSingleInstance();
			$dbResult = $entity->getList(
				array(
					'order' => array('SORT' => 'ASC', 'ID' => 'ASC'),
					'filter' => self::getActivePresetFilter(),
					'select' => array('ID', 'NAME')
				)
			);

			$results = [];
			while ($fields = $dbResult->fetch())
			{
				$results[$fields['ID']] = $fields['NAME'];
			}

			$cache->endDataCache($results);
		}

		static::$staticCache[static::CACHE_ID_ACTIVE_ITEM_LIST] = $results;
	}

	return $results;
}

Добавить комментарий