Same name and namespace in other branches
  1. 8.9.x core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php \Drupal\migrate\Plugin\MigrateDestinationPluginManager
  2. 9 core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php \Drupal\migrate\Plugin\MigrateDestinationPluginManager

Plugin manager for migrate destination plugins.

Hierarchy

Expanded class hierarchy of MigrateDestinationPluginManager

See also

\Drupal\migrate\Plugin\MigrateDestinationInterface

\Drupal\migrate\Plugin\migrate\destination\DestinationBase

\Drupal\migrate\Attribute\MigrateDestination

Plugin API

Related topics

2 files declare their use of MigrateDestinationPluginManager
FieldMigration.php in core/modules/migrate_drupal/src/Plugin/migrate/FieldMigration.php
MigrationTest.php in core/modules/migrate/tests/src/Unit/MigrationTest.php
1 string reference to 'MigrateDestinationPluginManager'
migrate.services.yml in core/modules/migrate/migrate.services.yml
core/modules/migrate/migrate.services.yml
1 service uses MigrateDestinationPluginManager
plugin.manager.migrate.destination in core/modules/migrate/migrate.services.yml
Drupal\migrate\Plugin\MigrateDestinationPluginManager

File

core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php, line 20

Namespace

Drupal\migrate\Plugin
View source
class MigrateDestinationPluginManager extends MigratePluginManager {

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * Constructs a MigrateDestinationPluginManager object.
   *
   * @param string $type
   *   The type of the plugin: row, source, process, destination, entity_field,
   *   id_map.
   * @param \Traversable $namespaces
   *   An object that implements \Traversable which contains the root paths
   *   keyed by the corresponding namespace to look for plugin implementations.
   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
   *   Cache backend instance to use.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler to invoke the alter hook with.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param string $attribute
   *   (optional) The attribute class name. Defaults to
   *   'Drupal\migrate\Attribute\MigrateDestination'.
   * @param string $annotation
   *   (optional) The annotation class name. Defaults to
   *   'Drupal\migrate\Annotation\MigrateDestination'.
   */
  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EntityTypeManagerInterface $entity_type_manager, $attribute = MigrateDestination::class, $annotation = 'Drupal\\migrate\\Annotation\\MigrateDestination') {
    parent::__construct($type, $namespaces, $cache_backend, $module_handler, $attribute, $annotation);
    $this->entityTypeManager = $entity_type_manager;
  }

  /**
   * {@inheritdoc}
   *
   * A specific createInstance method is necessary to pass the migration on.
   */
  public function createInstance($plugin_id, array $configuration = [], MigrationInterface $migration = NULL) {
    if (str_starts_with($plugin_id, 'entity:') && !$this->entityTypeManager
      ->getDefinition(substr($plugin_id, 7), FALSE)) {
      $plugin_id = 'null';
    }
    return parent::createInstance($plugin_id, $configuration, $migration);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DiscoveryInterface::getDefinition public function Gets a specific plugin definition. 2
DiscoveryInterface::getDefinitions public function Gets the definition of all plugins for this type. 3
DiscoveryInterface::hasDefinition public function Indicates if a specific plugin definition exists.
MapperInterface::getInstance public function Gets or creates a plugin instance that satisfies the given options. 2
MigrateDestinationPluginManager::$entityTypeManager protected property The entity type manager.
MigrateDestinationPluginManager::createInstance public function A specific createInstance method is necessary to pass the migration on. Overrides MigratePluginManager::createInstance
MigrateDestinationPluginManager::__construct public function Constructs a MigrateDestinationPluginManager object. Overrides MigratePluginManager::__construct