MigrationPluginManager
class MigrationPluginManager extends DefaultPluginManager implements MigrationPluginManagerInterface, MigrateBuildDependencyInterface (View source)
Plugin manager for migration plugins.
Traits
Provides methods to use a cache backend while respecting a 'use caches' flag.
Properties
| protected DiscoveryInterface | $discovery | The object that discovers plugins managed by this manager. |
from PluginManagerBase |
| protected FactoryInterface | $factory | The object that instantiates plugins managed by this manager. |
from PluginManagerBase |
| protected MapperInterface|null | $mapper | The object that returns the preconfigured plugin instance appropriate for a particular runtime condition. |
from PluginManagerBase |
| protected array | $definitions | Cached definitions array. |
from DiscoveryCachedTrait |
| protected CacheBackendInterface | $cacheBackend | Cache backend instance. |
from UseCacheBackendTrait |
| protected bool | $useCaches | Flag whether caches should be used or skipped. |
from UseCacheBackendTrait |
| protected string | $cacheKey | The cache key. |
from DefaultPluginManager |
| protected array | $cacheTags | An array of cache tags to use for the cached definitions. |
from DefaultPluginManager |
| protected string | $alterHook | Name of the alter hook if one should be invoked. |
from DefaultPluginManager |
| protected string|bool | $subdir | The subdirectory within a namespace to look for plugins, or FALSE if the plugins are in the top level of the namespace. |
from DefaultPluginManager |
| protected ModuleHandlerInterface | $moduleHandler | The module handler. |
|
| protected array | $defaults | Provides default values for migrations. |
|
| protected string | $pluginDefinitionAnnotationName | The name of the annotation that contains the plugin definition. |
from DefaultPluginManager |
| protected string | $pluginInterface | The interface the plugins should implement. |
|
| protected Traversable | $namespaces | An object that implements \Traversable which contains the root paths keyed by the corresponding namespace to look for plugin implementations. |
from DefaultPluginManager |
| protected string[] | $additionalAnnotationNamespaces | Additional namespaces the annotation discovery mechanism should scan for annotation definitions. |
from DefaultPluginManager |
Methods
Gets a specific plugin definition.
Gets the plugin discovery.
Creates a pre-configured instance of a plugin.
Allows plugin managers to specify custom behavior if a plugin is not found.
Gets a preconfigured instance of a plugin.
Fetches from the cache backend, respecting the use caches flag.
Stores data in the persistent cache, respecting the use caches flag.
Construct a migration plugin manager.
Initialize the cache backend.
Clears static and persistent plugin definition caches.
Returns the cached plugin definitions of the decorated discovery class.
Sets a cache of plugin definitions for the decorated discovery class.
Performs extra processing on plugin definitions.
Finds plugin definitions.
Extracts the provider from a plugin definition.
Invokes the hook to alter the definitions if the alter hook is set.
Determines if the provider of a definition exists.
The cache contexts associated with this object.
Create pre-configured instance of plugin derivatives.
Create migrations given a tag.
Expand derivative migration dependencies.
Builds a dependency tree for the migrations and set their order.
Add one or more dependencies to a graph.
Creates a stub migration plugin from a definition array.
Details
abstract
getDefinitions()
{@inheritdoc}
getDefinition($plugin_id, $exception_on_invalid = TRUE)
{@inheritdoc}
protected array|null
doGetDefinition(array $definitions, string $plugin_id, bool $exception_on_invalid)
Gets a specific plugin definition.
hasDefinition($plugin_id)
{@inheritdoc}
protected DiscoveryInterface
getDiscovery()
Gets the plugin discovery.
This method overrides DefaultPluginManager::getDiscovery() in order to search for migration configurations in the MODULENAME/migrations directory.
protected FactoryInterface
getFactory()
Gets the plugin factory.
object
createInstance(string $plugin_id, array $configuration = [])
Creates a pre-configured instance of a plugin.
protected object
handlePluginNotFound(string $plugin_id, array $configuration)
Allows plugin managers to specify custom behavior if a plugin is not found.
object|false
getInstance(array $options)
Gets a preconfigured instance of a plugin.
protected object|false
cacheGet(string $cid)
Fetches from the cache backend, respecting the use caches flag.
protected
cacheSet(string $cid, mixed $data, int $expire = Cache::PERMANENT, array $tags = [])
Stores data in the persistent cache, respecting the use caches flag.
__construct(ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager)
Construct a migration plugin manager.
setCacheBackend(CacheBackendInterface $cache_backend, string $cache_key, array $cache_tags = [])
Initialize the cache backend.
Plugin definitions are cached using the provided cache backend.
protected
alterInfo(string $alter_hook)
Sets the alter hook name.
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!
protected array|null
getCachedDefinitions()
Returns the cached plugin definitions of the decorated discovery class.
protected
setCachedDefinitions(array $definitions)
Sets a cache of plugin definitions for the decorated discovery class.
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.
processDefinition($definition, $plugin_id)
Performs extra processing on plugin definitions.
By default we add defaults for the type to the definition. If a type has additional processing logic they can do that by replacing or extending the method.
protected array
findDefinitions()
Finds plugin definitions.
protected string|null
extractProviderFromDefinition(mixed $plugin_definition)
Extracts the provider from a plugin definition.
protected
alterDefinitions($definitions)
Invokes the hook to alter the definitions if the alter hook is set.
protected bool
providerExists($provider)
Determines if the provider of a definition exists.
string[]
getCacheContexts()
The cache contexts associated with this object.
These identify a specific variation/representation of the object.
Cache contexts are tokens: placeholders that are converted to cache keys by the @cache_contexts_manager service. The replacement value depends on the request context (the current URL, language, and so on). They're converted before storing an object in cache.
string[]
getCacheTags()
The cache tags associated with this object.
When this object is modified, these cache tags will be invalidated.
int
getCacheMaxAge()
The maximum age for which this object may be cached.
MigrationInterface[]
createInstances($migration_id, array $configuration = [])
Create pre-configured instance of plugin derivatives.
array|MigrationInterface[]
createInstancesByTag(string $tag)
Create migrations given a tag.
protected array
expandPluginIds(array $migration_ids)
Expand derivative migration dependencies.
We need to expand any derivative migrations. Derivative migrations are calculated by migration derivers such as D6NodeDeriver. This allows migrations to depend on the base id and then have a dependency on all derivative migrations. For example, d6_comment depends on d6_node but after we've expanded the dependencies it will depend on d6_node:page, d6_node:story and so on, for other derivative migrations.
array
buildDependencyMigration(array $migrations, array $dynamic_ids)
Builds a dependency tree for the migrations and set their order.
protected
addDependency(array $graph, int $id, string $dependency, array $dynamic_ids)
Add one or more dependencies to a graph.
Migration
createStubMigration(array $definition)
Creates a stub migration plugin from a definition array.