Chris@0: 'entity.manager']; Chris@18: Chris@18: /** Chris@18: * The entity type manager. Chris@0: * Chris@18: * @var \Drupal\Core\Entity\EntityTypeManagerInterface Chris@0: */ Chris@18: protected $entityTypeManager; Chris@0: Chris@0: /** Chris@0: * Constructs a MigrateDestinationPluginManager object. Chris@0: * Chris@0: * @param string $type Chris@0: * The type of the plugin: row, source, process, destination, entity_field, Chris@0: * id_map. Chris@0: * @param \Traversable $namespaces Chris@0: * An object that implements \Traversable which contains the root paths Chris@0: * keyed by the corresponding namespace to look for plugin implementations. Chris@0: * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend Chris@0: * Cache backend instance to use. Chris@0: * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler Chris@0: * The module handler to invoke the alter hook with. Chris@18: * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager Chris@18: * The entity type manager. Chris@0: * @param string $annotation Chris@0: * (optional) The annotation class name. Defaults to Chris@0: * 'Drupal\migrate\Annotation\MigrateDestination'. Chris@0: */ Chris@18: public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EntityTypeManagerInterface $entity_type_manager, $annotation = 'Drupal\migrate\Annotation\MigrateDestination') { Chris@0: parent::__construct($type, $namespaces, $cache_backend, $module_handler, $annotation); Chris@18: $this->entityTypeManager = $entity_type_manager; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: * Chris@0: * A specific createInstance method is necessary to pass the migration on. Chris@0: */ Chris@0: public function createInstance($plugin_id, array $configuration = [], MigrationInterface $migration = NULL) { Chris@18: if (substr($plugin_id, 0, 7) == 'entity:' && !$this->entityTypeManager->getDefinition(substr($plugin_id, 7), FALSE)) { Chris@0: $plugin_id = 'null'; Chris@0: } Chris@0: return parent::createInstance($plugin_id, $configuration, $migration); Chris@0: } Chris@0: Chris@0: }