• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Badge/Model/BadgeTable.php
  • Класс: Bitrix\Crm\Badge\Model\BadgeTable
  • Вызов: BadgeTable::deleteByEntity
static function deleteByEntity(ItemIdentifier $itemIdentifier, string $type = null, string $value = null): void
{
	$sqlHelper = Application::getConnection()->getSqlHelper();

	$sql =
		'DELETE FROM b_crm_item_badge'
		. ' WHERE ENTITY_TYPE_ID =' . $sqlHelper->convertToDbInteger($itemIdentifier->getEntityTypeId())
		. ' AND ENTITY_ID =' . $sqlHelper->convertToDbInteger($itemIdentifier->getEntityId())
	;

	if (isset($type))
	{
		$sql .= ' AND TYPE =' . $sqlHelper->convertToDbString($type);
	}

	if (isset($value))
	{
		$sql .= ' AND VALUE =' . $sqlHelper->convertToDbString($value);
	}

	Application::getConnection()->query($sql);
}