You are here

public function EntityManagerWrapper::getHandler in Devel 8

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

Returns a handler instance for the given entity type and handler.

Entity handlers are instantiated once per entity type and then cached in the entity type manager, and so subsequent calls to getHandler() for a particular entity type and handler type will return the same object. This means that properties on a handler may be used as a static cache, although as the handler is common to all entities of the same type, any data that is per-entity should be keyed by the entity ID.

Parameters

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

string $handler_type: The handler type to create an instance for.

Return value

object A handler instance.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

Overrides EntityTypeManagerInterface::getHandler

2 calls to EntityManagerWrapper::getHandler()
EntityManagerWrapper::getStorage in webprofiler/src/Entity/EntityManagerWrapper.php
Creates a new storage instance.
EntityManagerWrapper::getViewBuilder in webprofiler/src/Entity/EntityManagerWrapper.php
Creates a new view builder instance.

File

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

Class

EntityManagerWrapper
Class EntityManagerWrapper

Namespace

Drupal\webprofiler\Entity

Code

public function getHandler($entity_type, $handler_type) {
  return $this->entityManager
    ->getHandler($entity_type, $handler_type);
}