class MigrateDestinationPluginManager

Same name and namespace in other branches
  1. 11.x 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\Annotation\MigrateDestination

Plugin API

Related topics

1 file declares its use of MigrateDestinationPluginManager
FieldMigration.php in core/modules/migrate_drupal/src/Plugin/migrate/FieldMigration.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 19

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 $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, $annotation = 'Drupal\\migrate\\Annotation\\MigrateDestination') {
    parent::__construct($type, $namespaces, $cache_backend, $module_handler, $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 (substr($plugin_id, 0, 7) == 'entity:' && !$this->entityTypeManager
      ->getDefinition(substr($plugin_id, 7), FALSE)) {
      $plugin_id = 'null';
    }
    return parent::createInstance($plugin_id, $configuration, $migration);
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.