You are here

public function EntityManagerWrapper::getStorage in Devel 8

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Entity/EntityManagerWrapper.php \Drupal\webprofiler\Entity\EntityManagerWrapper::getStorage()
  2. 8.2 webprofiler/src/Entity/EntityManagerWrapper.php \Drupal\webprofiler\Entity\EntityManagerWrapper::getStorage()
  3. 4.x webprofiler/src/Entity/EntityManagerWrapper.php \Drupal\webprofiler\Entity\EntityManagerWrapper::getStorage()

Creates a new storage instance.

Parameters

string $entity_type_id: The entity type ID for this storage.

Return value

\Drupal\Core\Entity\EntityStorageInterface A storage instance.

Throws

\Drupal\Component\Plugin\Exception\PluginNotFoundException Thrown if the entity type doesn't exist.

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException Thrown if the storage handler couldn't be loaded.

Overrides EntityTypeManagerInterface::getStorage

File

webprofiler/src/Entity/EntityManagerWrapper.php, line 48

Class

EntityManagerWrapper
Class EntityManagerWrapper

Namespace

Drupal\webprofiler\Entity

Code

public function getStorage($entity_type) {

  /** @var ConfigEntityStorageInterface $handler */
  $handler = $this
    ->getHandler($entity_type, 'storage');
  $type = $handler instanceof ConfigEntityStorageInterface ? 'config' : 'content';
  if (!isset($this->loaded[$type][$entity_type])) {
    $handler = $this
      ->getStorageDecorator($entity_type, $handler);
    $this->loaded[$type][$entity_type] = $handler;
  }
  else {
    $handler = $this->loaded[$type][$entity_type];
  }
  return $handler;
}