• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/cleaning/entity/cleaning.php
  • Класс: Bitrix\Crm\Cleaning\Entity\CleaningTable
  • Вызов: CleaningTable::upsert
static function upsert(array $data)
{
	$entityTypeID = isset($data['ENTITY_TYPE_ID']) ? (int)$data['ENTITY_TYPE_ID'] : \CCrmOwnerType::Undefined;
	$entityID = isset($data['ENTITY_ID']) ? (int)$data['ENTITY_ID'] : 0;

	$now = new Main\Type\DateTime();

	$connection = Main\Application::getConnection();
	$queries = $connection->getSqlHelper()->prepareMerge(
		'b_crm_cleaning',
		array('ENTITY_TYPE_ID', 'ENTITY_ID'),
		array(
			'ENTITY_TYPE_ID' => $entityTypeID,
			'ENTITY_ID' => $entityID,
			'CREATED_TIME' => $now,
			'LAST_UPDATED_TIME' => $now
		),
		array('LAST_UPDATED_TIME' => $now)
	);

	foreach($queries as $query)
	{
		$connection->queryExecute($query);
	}
}