Drupal 8  8.0.2
EntityTypeManager Class Reference
Inheritance diagram for EntityTypeManager:

Public Member Functions

 __construct (\Traversable $namespaces, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, TranslationInterface $string_translation, ClassResolverInterface $class_resolver)
 
 getDefinition ($entity_type_id, $exception_on_invalid=TRUE)
 
 clearCachedDefinitions ()
 
 useCaches ($use_caches=FALSE)
 
 hasHandler ($entity_type, $handler_type)
 
 getStorage ($entity_type)
 
 getListBuilder ($entity_type)
 
 getFormObject ($entity_type, $operation)
 
 getRouteProviders ($entity_type)
 
 getViewBuilder ($entity_type)
 
 getAccessControlHandler ($entity_type)
 
 getHandler ($entity_type, $handler_type)
 
 createHandlerInstance ($class, EntityTypeInterface $definition=NULL)
 
- Public Member Functions inherited from DefaultPluginManager
 __construct ($subdir,\Traversable $namespaces, ModuleHandlerInterface $module_handler, $plugin_interface=NULL, $plugin_definition_annotation_name= 'Drupal\Component\Annotation\Plugin')
 
 setCacheBackend (CacheBackendInterface $cache_backend, $cache_key, array $cache_tags=array())
 
 getDefinitions ()
 
 clearCachedDefinitions ()
 
 useCaches ($use_caches=FALSE)
 
 processDefinition (&$definition, $plugin_id)
 
- Public Member Functions inherited from PluginManagerBase
 getDefinition ($plugin_id, $exception_on_invalid=TRUE)
 
 getDefinitions ()
 
 createInstance ($plugin_id, array $configuration=array())
 
 getInstance (array $options)
 
- Public Member Functions inherited from DiscoveryInterface
 hasDefinition ($plugin_id)
 
- Public Member Functions inherited from EntityTypeManagerInterface
 getDefinitions ()
 

Protected Member Functions

 findDefinitions ()
 
- Protected Member Functions inherited from DefaultPluginManager
 alterInfo ($alter_hook)
 
 getCachedDefinitions ()
 
 setCachedDefinitions ($definitions)
 
 getDiscovery ()
 
 getFactory ()
 
 findDefinitions ()
 
 alterDefinitions (&$definitions)
 
 providerExists ($provider)
 
- Protected Member Functions inherited from PluginManagerBase
 getDiscovery ()
 
 getFactory ()
 

Protected Attributes

 $handlers = []
 
 $stringTranslation
 
 $classResolver
 
- Protected Attributes inherited from DefaultPluginManager
 $cacheKey
 
 $cacheTags = array()
 
 $alterHook
 
 $subdir
 
 $moduleHandler
 
 $defaults = array()
 
 $pluginDefinitionAnnotationName
 
 $pluginInterface
 
 $namespaces
 
- Protected Attributes inherited from PluginManagerBase
 $discovery
 
 $factory
 
 $mapper
 

Detailed Description

Manages entity type plugin definitions.

Each entity type definition array is set in the entity type's annotation and altered by hook_entity_type_alter().

See Also
hook_entity_type_alter()

Constructor & Destructor Documentation

__construct ( \Traversable  $namespaces,
ModuleHandlerInterface  $module_handler,
CacheBackendInterface  $cache,
TranslationInterface  $string_translation,
ClassResolverInterface  $class_resolver 
)

Constructs a new Entity plugin manager.

Parameters
\Traversable$namespacesAn object that implements which contains the root paths keyed by the corresponding namespace to look for plugin implementations,
\Drupal\Core\Extension\ModuleHandlerInterface$module_handlerThe module handler.
\Drupal\Core\Cache\CacheBackendInterface$cacheThe cache backend to use.
\Drupal\Core\StringTranslation\TranslationInterface$string_translationThe string translation.
\Drupal\Core\DependencyInjection\ClassResolverInterface$class_resolverThe class resolver.

References DefaultPluginManager\alterInfo(), and DefaultPluginManager\setCacheBackend().

Here is the call graph for this function:

Member Function Documentation

clearCachedDefinitions ( )

{Clears static and persistent plugin definition caches.Don't resort to calling ::cache()->delete() and friends to make Drupal detect new or updated plugin definitions. Always use this method on the appropriate plugin type's plugin manager!}

Implements CachedDiscoveryInterface.

createHandlerInstance (   $class,
EntityTypeInterface  $definition = NULL 
)

{Creates new handler instance.Usually ::getHandler() is preferred since that method has additional checking that the class exists and has static caches.

Parameters
mixed$classThe handler class to instantiate.
\Drupal\Core\Entity\EntityTypeInterface$definitionThe entity type definition.
Returns
object A handler instance.
}

Implements EntityTypeManagerInterface.

References Drupal\moduleHandler().

Referenced by EntityTypeManager\getHandler(), and EntityTypeManager\getRouteProviders().

Here is the call graph for this function:

Here is the caller graph for this function:

findDefinitions ( )
protected

{}

References DefaultPluginManager\alterDefinitions(), DefaultPluginManager\getDiscovery(), Drupal\moduleHandler(), and DefaultPluginManager\processDefinition().

Here is the call graph for this function:

getAccessControlHandler (   $entity_type)

{Creates a new access control handler instance.

Parameters
string$entity_typeThe entity type for this access control handler.
Returns
. A access control handler instance.
}

Implements EntityTypeManagerInterface.

References EntityTypeManager\getHandler().

Here is the call graph for this function:

getDefinition (   $entity_type_id,
  $exception_on_invalid = TRUE 
)

{{Gets a specific plugin definition.

Parameters
string$plugin_idA plugin id.
bool$exception_on_invalid(optional) If TRUE, an invalid plugin ID will throw an exception.
Returns
mixed A plugin definition, or NULL if the plugin ID is invalid and $exception_on_invalid is FALSE.
Exceptions
\Drupal\Component\Plugin\Exception\PluginNotFoundExceptionThrown if $plugin_id is invalid and $exception_on_invalid is TRUE.
}
Returns
|null
}

Implements EntityTypeManagerInterface.

Referenced by EntityTypeManager\getFormObject(), EntityTypeManager\getHandler(), EntityTypeManager\getRouteProviders(), and EntityTypeManager\hasHandler().

Here is the caller graph for this function:

getFormObject (   $entity_type,
  $operation 
)

{Creates a new form instance.

Parameters
string$entity_typeThe entity type for this form.
string$operationThe name of the operation to use, e.g., 'default'.
Returns
A form instance.
}

Implements EntityTypeManagerInterface.

References Drupal\entityManager(), EntityTypeManager\getDefinition(), and Drupal\moduleHandler().

Here is the call graph for this function:

getHandler (   $entity_type,
  $handler_type 
)

{Creates a new handler instance for a entity type and handler type.

Parameters
string$entity_typeThe entity type for this handler.
string$handler_typeThe handler type to create an instance for.
Returns
object A handler instance.
Exceptions
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
}

Implements EntityTypeManagerInterface.

References EntityTypeManager\createHandlerInstance(), and EntityTypeManager\getDefinition().

Referenced by EntityTypeManager\getAccessControlHandler(), EntityTypeManager\getListBuilder(), EntityTypeManager\getStorage(), and EntityTypeManager\getViewBuilder().

Here is the call graph for this function:

Here is the caller graph for this function:

getListBuilder (   $entity_type)

{Creates a new entity list builder.

Parameters
string$entity_typeThe entity type for this list builder.
Returns
An entity list builder instance.
}

Implements EntityTypeManagerInterface.

References EntityTypeManager\getHandler().

Here is the call graph for this function:

getRouteProviders (   $entity_type)

{Gets all route provider instances.

Parameters
string$entity_typeThe entity type for this route providers.
Returns
[]
}

Implements EntityTypeManagerInterface.

References EntityTypeManager\createHandlerInstance(), and EntityTypeManager\getDefinition().

Here is the call graph for this function:

getStorage (   $entity_type)

{Creates a new storage instance.

Parameters
string$entity_typeThe entity type for this storage.
Returns
A storage instance.
Exceptions
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
}

Implements EntityTypeManagerInterface.

References EntityTypeManager\getHandler().

Here is the call graph for this function:

getViewBuilder (   $entity_type)

{Creates a new view builder instance.

Parameters
string$entity_typeThe entity type for this view builder.
Returns
. A view builder instance.
}

Implements EntityTypeManagerInterface.

References EntityTypeManager\getHandler().

Here is the call graph for this function:

hasHandler (   $entity_type,
  $handler_type 
)

{Checks whether a certain entity type has a certain handler.

Parameters
string$entity_typeThe name of the entity type.
string$handler_typeThe name of the handler.
Returns
bool Returns TRUE if the entity type has the handler, else FALSE.
}

Implements EntityTypeManagerInterface.

References EntityTypeManager\getDefinition().

Here is the call graph for this function:

useCaches (   $use_caches = FALSE)

{Disable the use of caches.Can be used to ensure that uncached plugin definitions are returned, without invalidating all cached information.This will also remove all local/static caches.

Parameters
bool$use_cachesFALSE to not use any caches.
}

Implements CachedDiscoveryInterface.


The documentation for this class was generated from the following file: