- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/integrity/entity/automaticduplicateindex.php
- Класс: Bitrix\Crm\Integrity\Entity\AutomaticDuplicateIndexTable
- Вызов: AutomaticDuplicateIndexTable::markAsDirty
static function markAsDirty($entityTypeID, $entityID)
{
$connection = Main\Application::getConnection();
$query = static::query();
$query->registerRuntimeField('',
new Reference(
'MATCH_HASH_ENTITY',
DuplicateEntityMatchHashTable::class,
[
'=this.MATCH_HASH' => 'ref.MATCH_HASH',
'ref.ENTITY_TYPE_ID' => new Main\DB\SqlExpression('?i', $entityTypeID),
'ref.ENTITY_ID' => new Main\DB\SqlExpression('?i', $entityID),
],
['join_type' => \Bitrix\Main\ORM\Query\Join::TYPE_INNER]
));
$query->setSelect(['ID']);
$indexIds = array_map(
function ($item) {
return (int)$item['ID'];
}, $query->fetchAll()
);
if (empty($indexIds))
{
return;
}
$table = static::getTableName();
$splittedIds = array_chunk($indexIds, 1000);
foreach ($splittedIds as $ids)
{
$idsSql = implode(',', $ids);
$connection->queryExecute("UPDATE {$table} SET IS_DIRTY='Y' WHERE ID IN ({$idsSql})");
}
}