• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/lock.php
  • Класс: BitrixLandingLock
  • Вызов: Lock::lockEntity
static function lockEntity(int $entityId, string $entityType, string $lockType, bool $lock = true): bool
{
	$current = LockTable::getList([
		'select' => [
			'ID'
		],
		'filter' => [
			'ENTITY_ID' => $entityId,
			'=ENTITY_TYPE' => $entityType,
			'=LOCK_TYPE' => $lockType
		]
	])->fetch();
	if (!$lock && isset($current['ID']))
	{
		return LockTable::delete($current['ID'])->isSuccess();
	}
	if ($lock && !isset($current['ID']))
	{
		return LockTable::add([
			'ENTITY_ID' => $entityId,
			'ENTITY_TYPE' => $entityType,
			'LOCK_TYPE' => $lockType
		])->isSuccess();
	}
	return true;
}