class EntityManagerWrapper in Devel 8
Same name and namespace in other branches
- 8.3 webprofiler/src/Entity/EntityManagerWrapper.php \Drupal\webprofiler\Entity\EntityManagerWrapper
- 8.2 webprofiler/src/Entity/EntityManagerWrapper.php \Drupal\webprofiler\Entity\EntityManagerWrapper
- 4.x webprofiler/src/Entity/EntityManagerWrapper.php \Drupal\webprofiler\Entity\EntityManagerWrapper
Class EntityManagerWrapper
Hierarchy
- class \Drupal\Component\Plugin\PluginManagerBase implements PluginManagerInterface uses DiscoveryTrait
- class \Drupal\Core\Plugin\DefaultPluginManager implements CachedDiscoveryInterface, PluginManagerInterface, CacheableDependencyInterface uses DiscoveryCachedTrait, UseCacheBackendTrait
- class \Drupal\webprofiler\Entity\EntityManagerWrapper implements \Symfony\Component\DependencyInjection\ContainerAwareInterface, EntityTypeManagerInterface
- class \Drupal\Core\Plugin\DefaultPluginManager implements CachedDiscoveryInterface, PluginManagerInterface, CacheableDependencyInterface uses DiscoveryCachedTrait, UseCacheBackendTrait
Expanded class hierarchy of EntityManagerWrapper
1 string reference to 'EntityManagerWrapper'
- webprofiler.services.yml in webprofiler/
webprofiler.services.yml - webprofiler/webprofiler.services.yml
1 service uses EntityManagerWrapper
File
- webprofiler/
src/ Entity/ EntityManagerWrapper.php, line 21
Namespace
Drupal\webprofiler\EntityView source
class EntityManagerWrapper extends DefaultPluginManager implements EntityTypeManagerInterface, ContainerAwareInterface {
/**
* @var array
*/
private $loaded;
/**
* @var array
*/
private $rendered;
/**
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
private $entityManager;
/**
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityManager
*/
public function __construct(EntityTypeManagerInterface $entityManager) {
$this->entityManager = $entityManager;
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function getViewBuilder($entity_type) {
/** @var EntityViewBuilderInterface $handler */
$handler = $this
->getHandler($entity_type, 'view_builder');
if ($handler instanceof EntityViewBuilderInterface) {
if (!isset($this->rendered[$entity_type])) {
$handler = new EntityViewBuilderDecorator($handler);
$this->rendered[$entity_type] = $handler;
}
else {
$handler = $this->rendered[$entity_type];
}
}
return $handler;
}
/**
* @param $entity_type
* @param $handler
*
* @return \Drupal\webprofiler\Entity\EntityDecorator
*/
private function getStorageDecorator($entity_type, $handler) {
if ($handler instanceof ConfigEntityStorageInterface) {
switch ($entity_type) {
case 'taxonomy_vocabulary':
return new VocabularyStorageDecorator($handler);
break;
case 'user_role':
return new RoleStorageDecorator($handler);
break;
case 'shortcut_set':
return new ShortcutSetStorageDecorator($handler);
break;
case 'image_style':
return new ImageStyleStorageDecorator($handler);
break;
default:
return new ConfigEntityStorageDecorator($handler);
break;
}
}
return $handler;
}
/**
* @param $type
* @param $entity_type
*
* @return array
*/
public function getLoaded($type, $entity_type) {
return isset($this->loaded[$type][$entity_type]) ? $this->loaded[$type][$entity_type] : NULL;
}
/**
* @param $entity_type
*
* @return array
*/
public function getRendered($entity_type) {
return isset($this->rendered[$entity_type]) ? $this->rendered[$entity_type] : NULL;
}
/**
* {@inheritdoc}
*/
public function useCaches($use_caches = FALSE) {
$this->entityManager
->useCaches($use_caches);
}
/**
* {@inheritdoc}
*/
public function hasDefinition($plugin_id) {
return $this->entityManager
->hasDefinition($plugin_id);
}
/**
* {@inheritdoc}
*/
public function getAccessControlHandler($entity_type) {
return $this->entityManager
->getAccessControlHandler($entity_type);
}
/**
* {@inheritdoc}
*/
public function clearCachedDefinitions() {
$this->entityManager
->clearCachedDefinitions();
}
/**
* {@inheritdoc}
*/
public function getListBuilder($entity_type) {
return $this->entityManager
->getListBuilder($entity_type);
}
/**
* {@inheritdoc}
*/
public function getFormObject($entity_type, $operation) {
return $this->entityManager
->getFormObject($entity_type, $operation);
}
/**
* {@inheritdoc}
*/
public function getRouteProviders($entity_type) {
return $this->entityManager
->getRouteProviders($entity_type);
}
/**
* {@inheritdoc}
*/
public function hasHandler($entity_type, $handler_type) {
return $this->entityManager
->hasHandler($entity_type, $handler_type);
}
/**
* {@inheritdoc}
*/
public function getHandler($entity_type, $handler_type) {
return $this->entityManager
->getHandler($entity_type, $handler_type);
}
/**
* {@inheritdoc}
*/
public function createHandlerInstance($class, EntityTypeInterface $definition = NULL) {
return $this->entityManager
->createHandlerInstance($class, $definition);
}
/**
* {@inheritdoc}
*/
public function getDefinition($entity_type_id, $exception_on_invalid = TRUE) {
return $this->entityManager
->getDefinition($entity_type_id, $exception_on_invalid);
}
/**
* {@inheritdoc}
*/
public function getDefinitions() {
return $this->entityManager
->getDefinitions();
}
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = []) {
return $this->entityManager
->createInstance($plugin_id, $configuration);
}
/**
* {@inheritdoc}
*/
public function getInstance(array $options) {
return $this->entityManager
->getInstance($options);
}
/**
* {@inheritdoc}
*/
public function setContainer(ContainerInterface $container = NULL) {
$this->entityManager
->setContainer($container);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefaultPluginManager:: |
protected | property | Additional namespaces the annotation discovery mechanism should scan for annotation definitions. | |
DefaultPluginManager:: |
protected | property | Name of the alter hook if one should be invoked. | |
DefaultPluginManager:: |
protected | property | The cache key. | |
DefaultPluginManager:: |
protected | property | An array of cache tags to use for the cached definitions. | |
DefaultPluginManager:: |
protected | property | A set of defaults to be referenced by $this->processDefinition() if additional processing of plugins is necessary or helpful for development purposes. | 9 |
DefaultPluginManager:: |
protected | property | The module handler to invoke the alter hook. | 1 |
DefaultPluginManager:: |
protected | property | An object that implements \Traversable which contains the root paths keyed by the corresponding namespace to look for plugin implementations. | |
DefaultPluginManager:: |
protected | property | The name of the annotation that contains the plugin definition. | |
DefaultPluginManager:: |
protected | property | The interface each plugin should implement. | 1 |
DefaultPluginManager:: |
protected | property | The subdirectory within a namespace to look for plugins, or FALSE if the plugins are in the top level of the namespace. | |
DefaultPluginManager:: |
protected | function | Invokes the hook to alter the definitions if the alter hook is set. | 1 |
DefaultPluginManager:: |
protected | function | Sets the alter hook name. | |
DefaultPluginManager:: |
protected | function | Extracts the provider from a plugin definition. | |
DefaultPluginManager:: |
protected | function | Finds plugin definitions. | 7 |
DefaultPluginManager:: |
private | function | Fix the definitions of context-aware plugins. | |
DefaultPluginManager:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyInterface:: |
|
DefaultPluginManager:: |
protected | function | Returns the cached plugin definitions of the decorated discovery class. | |
DefaultPluginManager:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyInterface:: |
|
DefaultPluginManager:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyInterface:: |
|
DefaultPluginManager:: |
protected | function |
Gets the plugin discovery. Overrides PluginManagerBase:: |
12 |
DefaultPluginManager:: |
protected | function |
Gets the plugin factory. Overrides PluginManagerBase:: |
|
DefaultPluginManager:: |
public | function | Performs extra processing on plugin definitions. | 13 |
DefaultPluginManager:: |
protected | function | Determines if the provider of a definition exists. | 3 |
DefaultPluginManager:: |
public | function | Initialize the cache backend. | |
DefaultPluginManager:: |
protected | function | Sets a cache of plugin definitions for the decorated discovery class. | |
DiscoveryCachedTrait:: |
protected | property | Cached definitions array. | 1 |
DiscoveryTrait:: |
protected | function | Gets a specific plugin definition. | |
EntityManagerWrapper:: |
private | property | ||
EntityManagerWrapper:: |
private | property | ||
EntityManagerWrapper:: |
private | property | ||
EntityManagerWrapper:: |
public | function |
Clears static and persistent plugin definition caches. Overrides DefaultPluginManager:: |
|
EntityManagerWrapper:: |
public | function |
Creates new handler instance. Overrides EntityTypeManagerInterface:: |
|
EntityManagerWrapper:: |
public | function |
Creates a pre-configured instance of a plugin. Overrides PluginManagerBase:: |
|
EntityManagerWrapper:: |
public | function |
Creates a new access control handler instance. Overrides EntityTypeManagerInterface:: |
|
EntityManagerWrapper:: |
public | function |
Gets a specific plugin definition. Overrides DiscoveryCachedTrait:: |
|
EntityManagerWrapper:: |
public | function |
Gets the definition of all plugins for this type. Overrides DefaultPluginManager:: |
|
EntityManagerWrapper:: |
public | function |
Creates a new form instance. Overrides EntityTypeManagerInterface:: |
|
EntityManagerWrapper:: |
public | function |
Returns a handler instance for the given entity type and handler. Overrides EntityTypeManagerInterface:: |
|
EntityManagerWrapper:: |
public | function |
Gets a preconfigured instance of a plugin. Overrides PluginManagerBase:: |
|
EntityManagerWrapper:: |
public | function |
Creates a new entity list builder. Overrides EntityTypeManagerInterface:: |
|
EntityManagerWrapper:: |
public | function | ||
EntityManagerWrapper:: |
public | function | ||
EntityManagerWrapper:: |
public | function |
Gets all route provider instances. Overrides EntityTypeManagerInterface:: |
|
EntityManagerWrapper:: |
public | function |
Creates a new storage instance. Overrides EntityTypeManagerInterface:: |
|
EntityManagerWrapper:: |
private | function | ||
EntityManagerWrapper:: |
public | function |
Creates a new view builder instance. Overrides EntityTypeManagerInterface:: |
|
EntityManagerWrapper:: |
public | function |
Indicates if a specific plugin definition exists. Overrides DiscoveryTrait:: |
|
EntityManagerWrapper:: |
public | function |
Checks whether a certain entity type has a certain handler. Overrides EntityTypeManagerInterface:: |
|
EntityManagerWrapper:: |
public | function | Sets the Container. | |
EntityManagerWrapper:: |
public | function |
Disable the use of caches. Overrides DefaultPluginManager:: |
|
EntityManagerWrapper:: |
public | function |
Overrides DefaultPluginManager:: |
|
PluginManagerBase:: |
protected | property | The object that discovers plugins managed by this manager. | |
PluginManagerBase:: |
protected | property | The object that instantiates plugins managed by this manager. | |
PluginManagerBase:: |
protected | property | The object that returns the preconfigured plugin instance appropriate for a particular runtime condition. | |
PluginManagerBase:: |
protected | function | Allows plugin managers to specify custom behavior if a plugin is not found. | 1 |
UseCacheBackendTrait:: |
protected | property | Cache backend instance. | |
UseCacheBackendTrait:: |
protected | property | Flag whether caches should be used or skipped. | |
UseCacheBackendTrait:: |
protected | function | Fetches from the cache backend, respecting the use caches flag. | 1 |
UseCacheBackendTrait:: |
protected | function | Stores data in the persistent cache, respecting the use caches flag. |