SharedTempStore::deleteIfOwner

public SharedTempStore::deleteIfOwner($key)

Deletes data from the store for a given key and releases the lock on it.

Only delete the given key if it is owned by $this->owner.

Parameters

string $key: The key of the data to delete.

Return value

bool TRUE if the object was deleted or does not exist, FALSE if it exists but is not owned by $this->owner.

File

core/modules/user/src/SharedTempStore.php, line 255

Class

SharedTempStore
Stores and retrieves temporary data for a given owner.

Namespace

Drupal\user

Code

public function deleteIfOwner($key) {
  if (!$object = $this->storage->get($key)) {
    return TRUE;
  }
  elseif ($object->owner == $this->owner) {
    $this->delete($key);
    return TRUE;
  }

  return FALSE;
}
doc_Drupal
2016-10-29 09:42:17
Comments
Leave a Comment

Please login to continue.