function MigrationPluginManager::getDiscovery
Same name in other branches
- 9 core/modules/migrate/src/Plugin/MigrationPluginManager.php \Drupal\migrate\Plugin\MigrationPluginManager::getDiscovery()
- 10 core/modules/migrate/src/Plugin/MigrationPluginManager.php \Drupal\migrate\Plugin\MigrationPluginManager::getDiscovery()
- 11.x core/modules/migrate/src/Plugin/MigrationPluginManager.php \Drupal\migrate\Plugin\MigrationPluginManager::getDiscovery()
Gets the plugin discovery.
This method overrides DefaultPluginManager::getDiscovery() in order to search for migration configurations in the MODULENAME/migrations and MODULENAME/migration_templates directories. Throws a deprecation notice if the MODULENAME/migration_templates directory exists.
Overrides DefaultPluginManager::getDiscovery
File
-
core/
modules/ migrate/ src/ Plugin/ MigrationPluginManager.php, line 70
Class
- MigrationPluginManager
- Plugin manager for migration plugins.
Namespace
Drupal\migrate\PluginCode
protected function getDiscovery() {
if (!isset($this->discovery)) {
$directories = array_map(function ($directory) {
// Check for use of the @deprecated /migration_templates directory.
// @todo Remove use of /migration_templates in Drupal 9.0.0.
if (is_dir($directory . '/migration_templates')) {
@trigger_error('Use of the /migration_templates directory to store migration configuration files is deprecated in Drupal 8.1.0 and will be removed before Drupal 9.0.0. See https://www.drupal.org/node/2920988.', E_USER_DEPRECATED);
}
// But still accept configurations found in /migration_templates.
return [
$directory . '/migration_templates',
$directory . '/migrations',
];
}, $this->moduleHandler
->getModuleDirectories());
$yaml_discovery = new YamlDirectoryDiscovery($directories, 'migrate');
// This gets rid of migrations which try to use a non-existent source
// plugin. The common case for this is if the source plugin has, or
// specifies, a non-existent provider.
$only_with_source_discovery = new NoSourcePluginDecorator($yaml_discovery);
// This gets rid of migrations with explicit providers set if one of the
// providers do not exist before we try to use a potentially non-existing
// deriver. This is a rare case.
$filtered_discovery = new ProviderFilterDecorator($only_with_source_discovery, [
$this->moduleHandler,
'moduleExists',
]);
$this->discovery = new ContainerDerivativeDiscoveryDecorator($filtered_discovery);
}
return $this->discovery;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.