EntityRelationTable::replaceBindings

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. EntityRelationTable
  4. replaceBindings
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Relation/EntityRelationTable.php
  • Класс: Bitrix\Crm\Relation\EntityRelationTable
  • Вызов: EntityRelationTable::replaceBindings
static function replaceBindings(ItemIdentifier $fromItem, ItemIdentifier $toItem): void
{
	$entityTypeId = $toItem->getEntityTypeId();
	$fromId = $fromItem->getEntityId();
	$toId = $toItem->getEntityId();

	$connection = Application::getConnection();
	$tableName = $connection->getSqlHelper()->quote(static::getTableName());

	$srcSql = "UPDATE IGNORE {$tableName} SET  SRC_ENTITY_ID = {$toId} WHERE SRC_ENTITY_ID = {$fromId} AND SRC_ENTITY_TYPE_ID = {$entityTypeId}";
	$dstSql = "UPDATE IGNORE {$tableName} SET  DST_ENTITY_ID = {$toId} WHERE DST_ENTITY_ID = {$fromId} AND DST_ENTITY_TYPE_ID = {$entityTypeId}";
	$connection->query($srcSql);
	$connection->query($dstSql);
}

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