You are here

public function CommandHelper::reloadEntityOverrideFree in Search API 8

Loads an override-free copy of a config entity, for saving.

Parameters

\Drupal\Core\Config\Entity\ConfigEntityInterface $entity: The entity to reload.

Return value

\Drupal\Core\Entity\EntityInterface|null The override-free version of the entity, or NULL if it couldn't be loaded.

5 calls to CommandHelper::reloadEntityOverrideFree()
CommandHelper::clearServerCommand in src/Utility/CommandHelper.php
Clears all indexes on a server.
CommandHelper::disableServerCommand in src/Utility/CommandHelper.php
Disables a server.
CommandHelper::enableServerCommand in src/Utility/CommandHelper.php
Enables a server.
CommandHelper::setIndexServerCommand in src/Utility/CommandHelper.php
Switches an index to another server.
CommandHelper::setIndexState in src/Utility/CommandHelper.php
Changes the state of a single index.

File

src/Utility/CommandHelper.php, line 725

Class

CommandHelper
Provides functionality to be used by CLI tools.

Namespace

Drupal\search_api\Utility

Code

public function reloadEntityOverrideFree(ConfigEntityInterface $entity) {
  try {

    /** @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $storage */
    $storage = $this->entityTypeManager
      ->getStorage($entity
      ->getEntityTypeId());
    return $storage
      ->loadOverrideFree($entity
      ->id());
  } catch (InvalidPluginDefinitionException $e) {
    return NULL;
  }
}