You are here

public function UnsavedIndexConfiguration::getLockOwner in Search API 8

Retrieves the owner of the lock on this configuration, if any.

Return value

\Drupal\user\UserInterface|null The lock's owner; or NULL if this object represents the still unchanged configuration that is currently stored.

Overrides UnsavedConfigurationInterface::getLockOwner

File

src/UnsavedIndexConfiguration.php, line 129

Class

UnsavedIndexConfiguration
Represents a configuration of an index that was not yet permanently saved.

Namespace

Drupal\search_api

Code

public function getLockOwner() {
  if (!$this->lock) {
    return NULL;
  }
  $owner_id = $this->lock
    ->getOwnerId();
  $uid = is_numeric($owner_id) ? $owner_id : 0;
  try {
    return $this
      ->getEntityTypeManager()
      ->getStorage('user')
      ->load($uid);
  } catch (InvalidPluginDefinitionException $e) {
    return NULL;
  } catch (PluginNotFoundException $e) {
    return NULL;
  }
}