You are here

protected function ContentLock::lockingDelete in Content locking (anti-concurrent editing) 8

Same name and namespace in other branches
  1. 8.2 src/ContentLock/ContentLock.php \Drupal\content_lock\ContentLock\ContentLock::lockingDelete()

Delete locking item from database.

Parameters

int $entity_id: The entity id.

string $langcode: The translation language of the entity.

string $form_op: (optional) The entity form operation.

int $uid: The user uid.

string $entity_type: The entity type.

Return value

bool The result of the delete query.

1 call to ContentLock::lockingDelete()
ContentLock::release in src/ContentLock/ContentLock.php
Release a locked entity.

File

src/ContentLock/ContentLock.php, line 343

Class

ContentLock
Class ContentLock.

Namespace

Drupal\content_lock\ContentLock

Code

protected function lockingDelete($entity_id, $langcode, $form_op = NULL, $uid = NULL, $entity_type = 'node') {
  if (!$this
    ->isTranslationLockEnabled($entity_type)) {
    $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED;
  }
  if (!$this
    ->isFormOperationLockEnabled($entity_type)) {
    $form_op = '*';
  }
  $query = $this->database
    ->delete('content_lock')
    ->condition('entity_type', $entity_type)
    ->condition('entity_id', $entity_id)
    ->condition('langcode', $langcode);
  if (isset($form_op)) {
    $query
      ->condition('form_op', $form_op);
  }
  if (!empty($uid)) {
    $query
      ->condition('uid', $uid);
  }
  $result = $query
    ->execute();
  return $result;
}