DedupeConfigCleaner::getListByEntityTypes

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. DedupeConfigCleaner
  4. getListByEntityTypes
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integrity/dedupeconfigcleaner.php
  • Класс: Bitrix\Crm\Integrity\DedupeConfigCleaner
  • Вызов: DedupeConfigCleaner::getListByEntityTypes
protected function getListByEntityTypes(array $entityTypeIds): Main\DB\Result
{
	$connection = Application::getConnection();
	$helper = $connection->getSqlHelper();

	$conditions = [];
	$fieldNameSql = '`NAME`';
	foreach ($entityTypeIds as $entityTypeId)
	{
		$entityTypeNameSql = mb_strtolower(CCrmOwnerType::ResolveName($entityTypeId));
		$nameValueSql = $helper->forSql("{$entityTypeNameSql}_dedupe_wizard");
		$conditions[] = "$fieldNameSql = '$nameValueSql'";
	}
	$nameConditionSql = empty($conditions) ? '' : ' AND (' . implode(' OR ', $conditions) . ')';

	$categorySql = $helper->forSql(DedupeConfig::OPTION_KEY);

	return $connection->query(
		"SELECT ID, USER_ID, `NAME` FROM b_user_option WHERE CATEGORY = '$categorySql'$nameConditionSql"
	);
}

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