EntityPreset::getListForRequisiteEntityEditor

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

	if (isset(static::$staticCache[static::CACHE_ID_LIST_FOR_REQUISITE_ENTITY_EDITOR]))
	{
		$results = static::$staticCache[static::CACHE_ID_LIST_FOR_REQUISITE_ENTITY_EDITOR];
	}
	else
	{
		$cache = Cache::createInstance();
		if (
			$cache->initCache(
				static::CACHE_TTL,
				static::CACHE_ID_LIST_FOR_REQUISITE_ENTITY_EDITOR,
				static::CACHE_PATH
			)
		)
		{
			$results = $cache->getVars();
		}
		elseif ($cache->startDataCache())
		{
			$results = [];

			$entity = self::getSingleInstance();
			$dbResult = $entity->getList(
				array(
					'order' => array('SORT' => 'ASC', 'ID' => 'ASC'),
					'filter' => self::getActivePresetFilter(),
					'select' => array('ID', 'NAME', 'COUNTRY_ID')
				)
			);
			while ($fields = $dbResult->fetch())
			{
				$results[$fields['ID']] = $fields;
			}

			$cache->endDataCache($results);
		}

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

	return $results;
}

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