EntityTypeManagerInterface
interface EntityTypeManagerInterface implements PluginManagerInterface, CachedDiscoveryInterface (View source)
Provides an interface for entity type managers.
Methods
Gets a specific plugin definition.
Gets the definition of all plugins for this type.
Indicates if a specific plugin definition exists.
Creates a pre-configured instance of a plugin.
Gets a preconfigured instance of a plugin.
Clears static and persistent plugin definition caches.
Creates a new access control handler instance.
Creates a new storage instance.
Creates a new view builder instance.
Creates a new entity list builder.
Creates a new form instance.
Gets all route provider instances.
Checks whether a certain entity type has a certain handler.
Returns a handler instance for the given entity type and handler.
Creates new handler instance.
Details
mixed
getDefinition($entity_type_id, bool $exception_on_invalid = TRUE)
Gets a specific plugin definition.
array
getDefinitions()
Gets the definition of all plugins for this type.
bool
hasDefinition(string $plugin_id)
Indicates if a specific plugin definition exists.
object
createInstance(string $plugin_id, array $configuration = [])
Creates a pre-configured instance of a plugin.
object|false
getInstance(array $options)
Gets a preconfigured instance of a plugin.
clearCachedDefinitions()
Clears static and persistent plugin definition caches.
Don't resort to calling \Drupal::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!
useCaches(bool $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.
EntityAccessControlHandlerInterface
getAccessControlHandler(string $entity_type_id)
Creates a new access control handler instance.
EntityStorageInterface
getStorage(string $entity_type_id)
Creates a new storage instance.
EntityViewBuilderInterface
getViewBuilder(string $entity_type_id)
Creates a new view builder instance.
EntityListBuilderInterface
getListBuilder(string $entity_type_id)
Creates a new entity list builder.
EntityFormInterface
getFormObject(string $entity_type_id, string $operation)
Creates a new form instance.
EntityRouteProviderInterface[]
getRouteProviders(string $entity_type_id)
Gets all route provider instances.
bool
hasHandler(string $entity_type_id, string $handler_type)
Checks whether a certain entity type has a certain handler.
object
getHandler(string $entity_type_id, string $handler_type)
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.
object
createHandlerInstance(mixed $class, EntityTypeInterface $definition = NULL)
Creates new handler instance.
Usually \Drupal\Core\Entity\EntityTypeManagerInterface::getHandler() is preferred since that method has additional checking that the class exists and has static caches.