diff --git a/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php b/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php index 94135fd..914138b 100644 --- a/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php +++ b/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php @@ -33,26 +33,23 @@ class BlockedIP extends DestinationBase implements ContainerFactoryPluginInterfa * @param string $plugin_id * The plugin ID. * @param mixed $plugin_definition - * The plugin definiiton. - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * The current migration. + * The plugin definition. * @param \Drupal\ban\BanIpManagerInterface $ban_manager * The IP manager service. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, BanIpManagerInterface $ban_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration); + public function __construct(array $configuration, $plugin_id, $plugin_definition, BanIpManagerInterface $ban_manager) { + parent::__construct($configuration, $plugin_id, $plugin_definition); $this->banManager = $ban_manager; } /** * {@inheritdoc} */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $configuration, $plugin_id, $plugin_definition, - $migration, $container->get('ban.ip_manager') ); } diff --git a/core/modules/comment/migration_templates/d6_comment_field.yml b/core/modules/comment/migration_templates/d6_comment_field.yml index 469d604..d14d1aa 100644 --- a/core/modules/comment/migration_templates/d6_comment_field.yml +++ b/core/modules/comment/migration_templates/d6_comment_field.yml @@ -13,7 +13,10 @@ process: type: 'constants/type' 'settings/comment_type': comment_type destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config + dependencies: + module: + - comment migration_dependencies: required: - d6_comment_type diff --git a/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php b/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php index e3582c5..91b4e6f 100644 --- a/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php +++ b/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php @@ -64,8 +64,8 @@ class EntityComment extends EntityContentBase { * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query * The query object that can query the given entity type. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, StateInterface $state, QueryFactory $entity_query) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $entity_manager, $field_type_manager); + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, StateInterface $state, QueryFactory $entity_query) { + parent::__construct($configuration, $plugin_id, $plugin_definition, $storage, $bundles, $entity_manager, $field_type_manager); $this->state = $state; $this->entityQuery = $entity_query; } @@ -79,7 +79,6 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $migration, $container->get('entity.manager')->getStorage($entity_type), array_keys($container->get('entity.manager')->getBundleInfo($entity_type)), $container->get('entity.manager'), diff --git a/core/modules/field/migration_templates/d6_field.yml b/core/modules/field/migration_templates/d6_field.yml index 531bc13..353b47e 100644 --- a/core/modules/field/migration_templates/d6_field.yml +++ b/core/modules/field/migration_templates/d6_field.yml @@ -128,4 +128,4 @@ process: - global_settings destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config diff --git a/core/modules/file/migration_templates/d6_upload_field.yml b/core/modules/file/migration_templates/d6_upload_field.yml index c0b4569..a919f91 100644 --- a/core/modules/file/migration_templates/d6_upload_field.yml +++ b/core/modules/file/migration_templates/d6_upload_field.yml @@ -20,4 +20,7 @@ process: cardinality: 'constants/cardinality' 'settings/display_field': 'constants/display_field' destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config + dependencies: + module: + - file diff --git a/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php b/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php index 0f69308..11b28c9 100644 --- a/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php +++ b/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php @@ -39,17 +39,11 @@ public function getIds(); * Derived classes must implement fields(), returning a list of available * destination fields. * - * @todo Review the cases where we need the Migration parameter, can we avoid - * that? To be resolved with https://www.drupal.org/node/2543568. - * - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * (optional) The migration containing this destination. Defaults to NULL. - * * @return array * - Keys: machine names of the fields * - Values: Human-friendly descriptions of the fields. */ - public function fields(MigrationInterface $migration = NULL); + public function fields(); /** * Import the row. diff --git a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php index 74100cf..f664ae8 100644 --- a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php +++ b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php @@ -2,9 +2,11 @@ namespace Drupal\migrate\Plugin; +use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\Plugin\DefaultPluginManager; /** * Plugin manager for migrate destination plugins. @@ -16,7 +18,7 @@ * * @ingroup migration */ -class MigrateDestinationPluginManager extends MigratePluginManager { +class MigrateDestinationPluginManager extends DefaultPluginManager { /** * The entity manager. @@ -29,8 +31,7 @@ class MigrateDestinationPluginManager extends MigratePluginManager { * Constructs a MigrateDestinationPluginManager object. * * @param string $type - * The type of the plugin: row, source, process, destination, entity_field, - * id_map. + * The type of the plugin: destination. * @param \Traversable $namespaces * An object that implements \Traversable which contains the root paths * keyed by the corresponding namespace to look for plugin implementations. @@ -45,20 +46,11 @@ class MigrateDestinationPluginManager extends MigratePluginManager { * 'Drupal\migrate\Annotation\MigrateDestination'. */ public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EntityManagerInterface $entity_manager, $annotation = 'Drupal\migrate\Annotation\MigrateDestination') { - parent::__construct($type, $namespaces, $cache_backend, $module_handler, $annotation); + $plugin_interface = isset($plugin_interface_map[$type]) ? $plugin_interface_map[$type] : NULL; + parent::__construct("Plugin/migrate/$type", $namespaces, $module_handler, $plugin_interface, $annotation); + $this->alterInfo('migrate_' . $type . '_info'); + $this->setCacheBackend($cache_backend, 'migrate_plugins_' . $type); $this->entityManager = $entity_manager; } - /** - * {@inheritdoc} - * - * A specific createInstance method is necessary to pass the migration on. - */ - public function createInstance($plugin_id, array $configuration = array(), MigrationInterface $migration = NULL) { - if (substr($plugin_id, 0, 7) == 'entity:' && !$this->entityManager->getDefinition(substr($plugin_id, 7), FALSE)) { - $plugin_id = 'null'; - } - return parent::createInstance($plugin_id, $configuration, $migration); - } - } diff --git a/core/modules/migrate/src/Plugin/migrate/destination/Config.php b/core/modules/migrate/src/Plugin/migrate/destination/Config.php index 32d5e1b..fcb4a09 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/Config.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/Config.php @@ -50,15 +50,13 @@ class Config extends DestinationBase implements ContainerFactoryPluginInterface, * The plugin ID for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * The migration entity. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The configuration factory. * @param \Drupal\Core\Language\ConfigurableLanguageManagerInterface $language_manager * The language manager. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, ConfigFactoryInterface $config_factory, LanguageManagerInterface $language_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration); + public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, LanguageManagerInterface $language_manager) { + parent::__construct($configuration, $plugin_id, $plugin_definition); $this->config = $config_factory->getEditable($configuration['config_name']); $this->language_manager = $language_manager; } @@ -71,7 +69,6 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $migration, $container->get('config.factory'), $container->get('language_manager') ); diff --git a/core/modules/migrate/src/Plugin/migrate/destination/DestinationBase.php b/core/modules/migrate/src/Plugin/migrate/destination/DestinationBase.php index 18a95e6..a0d750d 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/DestinationBase.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/DestinationBase.php @@ -3,7 +3,6 @@ namespace Drupal\migrate\Plugin\migrate\destination; use Drupal\Core\Plugin\PluginBase; -use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Exception\RequirementsException; use Drupal\migrate\Plugin\MigrateDestinationInterface; use Drupal\migrate\Plugin\MigrateIdMapInterface; @@ -36,30 +35,6 @@ protected $rollbackAction = MigrateIdMapInterface::ROLLBACK_DELETE; /** - * The migration. - * - * @var \Drupal\migrate\Plugin\MigrationInterface - */ - protected $migration; - - /** - * Constructs an entity destination plugin. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * The migration. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->migration = $migration; - } - - /** * {@inheritdoc} */ public function rollbackAction() { diff --git a/core/modules/migrate/src/Plugin/migrate/destination/Entity.php b/core/modules/migrate/src/Plugin/migrate/destination/Entity.php index 1b2c2e7..0f611f2 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/Entity.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/Entity.php @@ -45,15 +45,13 @@ * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param MigrationInterface $migration - * The migration. * @param EntityStorageInterface $storage * The storage for this entity type. * @param array $bundles * The list of bundles this entity type has. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration); + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $storage, array $bundles) { + parent::__construct($configuration, $plugin_id, $plugin_definition); $this->storage = $storage; $this->bundles = $bundles; $this->supportsRollback = TRUE; @@ -62,13 +60,12 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition /** * {@inheritdoc} */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { $entity_type_id = static::getEntityTypeId($plugin_id); return new static( $configuration, $plugin_id, $plugin_definition, - $migration, $container->get('entity.manager')->getStorage($entity_type_id), array_keys($container->get('entity.manager')->getBundleInfo($entity_type_id)) ); diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php index d3adce8..1f92377 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php @@ -43,8 +43,6 @@ class EntityContentBase extends Entity { * The plugin ID for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * The migration entity. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The storage for this entity type. * @param array $bundles @@ -54,8 +52,8 @@ class EntityContentBase extends Entity { * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager * The field type plugin manager service. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles); + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager) { + parent::__construct($configuration, $plugin_id, $plugin_definition, $storage, $bundles); $this->entityManager = $entity_manager; $this->fieldTypeManager = $field_type_manager; } @@ -69,7 +67,6 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $migration, $container->get('entity.manager')->getStorage($entity_type), array_keys($container->get('entity.manager')->getBundleInfo($entity_type)), $container->get('entity.manager'), diff --git a/core/modules/migrate/tests/modules/migrate_events_test/src/Plugin/migrate/destination/DummyDestination.php b/core/modules/migrate/tests/modules/migrate_events_test/src/Plugin/migrate/destination/DummyDestination.php index 45420d3..6a40983 100644 --- a/core/modules/migrate/tests/modules/migrate_events_test/src/Plugin/migrate/destination/DummyDestination.php +++ b/core/modules/migrate/tests/modules/migrate_events_test/src/Plugin/migrate/destination/DummyDestination.php @@ -2,7 +2,6 @@ namespace Drupal\migrate_events_test\Plugin\migrate\destination; -use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Plugin\migrate\destination\DestinationBase; use Drupal\migrate\Row; @@ -25,7 +24,7 @@ public function getIds() { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { return ['value' => 'Dummy value']; } diff --git a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php index 33aec58..cada437 100644 --- a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php +++ b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php @@ -60,7 +60,6 @@ protected function setUp() { public function testImport() { $bundles = []; $destination = new EntityTestDestination([], '', [], - $this->migration->reveal(), $this->storage->reveal(), $bundles, $this->entityManager->reveal(), @@ -89,7 +88,6 @@ public function testImport() { public function testImportEntityLoadFailure() { $bundles = []; $destination = new EntityTestDestination([], '', [], - $this->migration->reveal(), $this->storage->reveal(), $bundles, $this->entityManager->reveal(), diff --git a/core/modules/migrate/tests/src/Unit/destination/ConfigTest.php b/core/modules/migrate/tests/src/Unit/destination/ConfigTest.php index 59b93d5..bdecd76 100644 --- a/core/modules/migrate/tests/src/Unit/destination/ConfigTest.php +++ b/core/modules/migrate/tests/src/Unit/destination/ConfigTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\migrate\Unit\destination; -use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Plugin\migrate\destination\Config; use Drupal\Tests\UnitTestCase; @@ -19,9 +18,6 @@ public function testImport() { $source = array( 'test' => 'x', ); - $migration = $this->getMockBuilder('Drupal\migrate\Plugin\Migration') - ->disableOriginalConstructor() - ->getMock(); $config = $this->getMockBuilder('Drupal\Core\Config\Config') ->disableOriginalConstructor() ->getMock(); @@ -57,7 +53,7 @@ public function testImport() { ->method('getLanguageConfigOverride') ->with('fr', 'd8_config') ->will($this->returnValue($config)); - $destination = new Config(array('config_name' => 'd8_config'), 'd8_config', array('pluginId' => 'd8_config'), $migration, $config_factory, $language_manager); + $destination = new Config(array('config_name' => 'd8_config'), 'd8_config', array('pluginId' => 'd8_config'), $config_factory, $language_manager); $destination_id = $destination->import($row); $this->assertEquals($destination_id, ['d8_config']); } @@ -69,9 +65,6 @@ public function testLanguageImport() { $source = array( 'langcode' => 'mi', ); - $migration = $this->getMockBuilder(MigrationInterface::class) - ->disableOriginalConstructor() - ->getMock(); $config = $this->getMockBuilder('Drupal\Core\Config\Config') ->disableOriginalConstructor() ->getMock(); @@ -110,7 +103,7 @@ public function testLanguageImport() { ->method('getLanguageConfigOverride') ->with('mi', 'd8_config') ->will($this->returnValue($config)); - $destination = new Config(array('config_name' => 'd8_config'), 'd8_config', array('pluginId' => 'd8_config'), $migration, $config_factory, $language_manager); + $destination = new Config(array('config_name' => 'd8_config'), 'd8_config', array('pluginId' => 'd8_config'), $config_factory, $language_manager); $destination_id = $destination->import($row); $this->assertEquals($destination_id, ['d8_config']); } diff --git a/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php b/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php index f1e288e..6b6cb9d 100644 --- a/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php +++ b/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php @@ -187,7 +187,6 @@ public function testSave() { */ protected function getEntityRevisionDestination(array $configuration = [], $plugin_id = 'entity_revision', array $plugin_definition = []) { return new EntityRevision($configuration, $plugin_id, $plugin_definition, - $this->migration->reveal(), $this->storage->reveal(), [], $this->entityManager->reveal(), diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php b/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php index cc8431d..5aa4f99 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php @@ -2,87 +2,19 @@ namespace Drupal\migrate_drupal\Plugin\migrate\destination; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Field\FieldTypePluginManagerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig as BaseEntityFieldStorageConfig; /** - * Destination with Drupal specific config dependencies. + * Deprecated. Destination with Drupal specific config dependencies. * * @MigrateDestination( * id = "md_entity:field_storage_config" * ) + * + * @deprecated in Drupal 8.2.x and will be removed before Drupal 9.0.x. Use + * \Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig + * instead. + * + * @see \Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig */ -class EntityFieldStorageConfig extends BaseEntityFieldStorageConfig { - - /** - * The field type plugin manager. - * - * @var \Drupal\Core\Field\FieldTypePluginManagerInterface - */ - protected $fieldTypePluginManager; - - /** - * Construct a new plugin. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * The migration. - * @param EntityStorageInterface $storage - * The storage for this entity type. - * @param array $bundles - * The list of bundles this entity type has. - * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_plugin_manager - * The field type plugin manager. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, FieldTypePluginManagerInterface $field_type_plugin_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles); - $this->fieldTypePluginManager = $field_type_plugin_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { - $entity_type_id = static::getEntityTypeId($plugin_id); - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $migration, - $container->get('entity.manager')->getStorage($entity_type_id), - array_keys($container->get('entity.manager')->getBundleInfo($entity_type_id)), - $container->get('plugin.manager.field.field_type') - ); - } - - /** - * {@inheritdoc} - */ - public function calculateDependencies() { - $this->dependencies = parent::calculateDependencies(); - // Add a dependency on the module that provides the field type using the - // source plugin configuration. - $source_configuration = $this->migration->getSourceConfiguration(); - if (isset($source_configuration['constants']['type'])) { - $field_type = $this->fieldTypePluginManager->getDefinition($source_configuration['constants']['type']); - $this->addDependency('module', $field_type['provider']); - } - return $this->dependencies; - } - - /** - * {@inheritdoc} - */ - protected static function getEntityTypeId($plugin_id) { - return 'field_storage_config'; - } - -} +class EntityFieldStorageConfig extends BaseEntityFieldStorageConfig { } diff --git a/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php b/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php index 3146990..c72fd44 100644 --- a/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php +++ b/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php @@ -32,13 +32,11 @@ class UrlAlias extends DestinationBase implements ContainerFactoryPluginInterfac * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * The migration. * @param \Drupal\Core\Path\AliasStorage $alias_storage * The alias storage service. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, AliasStorage $alias_storage) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration); + public function __construct(array $configuration, $plugin_id, $plugin_definition, AliasStorage $alias_storage) { + parent::__construct($configuration, $plugin_id, $plugin_definition); $this->aliasStorage = $alias_storage; } @@ -50,7 +48,6 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $migration, $container->get('path.alias_storage') ); } @@ -81,7 +78,7 @@ public function getIds() { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { return [ 'pid' => 'The path id', 'source' => 'The source path.', diff --git a/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php b/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php index cd86f0f..c265a1d 100644 --- a/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php +++ b/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php @@ -33,25 +33,22 @@ class ShortcutSetUsers extends DestinationBase implements ContainerFactoryPlugin * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * The migration. * @param \Drupal\shortcut\ShortcutSetStorageInterface $shortcut_set_storage * The shortcut_set entity storage handler. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, ShortcutSetStorageInterface $shortcut_set_storage) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration); + public function __construct(array $configuration, $plugin_id, $plugin_definition, ShortcutSetStorageInterface $shortcut_set_storage) { + parent::__construct($configuration, $plugin_id, $plugin_definition); $this->shortcutSetStorage = $shortcut_set_storage; } /** * {@inheritdoc} */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $configuration, $plugin_id, $plugin_definition, - $migration, $container->get('entity.manager')->getStorage('shortcut_set') ); } diff --git a/core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml b/core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml index a1c9735..0e1a487 100644 --- a/core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml +++ b/core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml @@ -22,7 +22,10 @@ process: 'settings/target_type': 'constants/target_entity_type' cardinality: cardinality destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config + dependencies: + module: + - entity_reference migration_dependencies: required: - d6_taxonomy_vocabulary diff --git a/core/modules/user/migration_templates/user_picture_field.yml b/core/modules/user/migration_templates/user_picture_field.yml index a484ab8..ff8bd82 100644 --- a/core/modules/user/migration_templates/user_picture_field.yml +++ b/core/modules/user/migration_templates/user_picture_field.yml @@ -18,4 +18,7 @@ process: type: 'constants/type' cardinality: 'constants/cardinality' destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config + dependencies: + module: + - image diff --git a/core/modules/user/migration_templates/user_profile_field.yml b/core/modules/user/migration_templates/user_profile_field.yml index bf81898..3ba0eee 100644 --- a/core/modules/user/migration_templates/user_profile_field.yml +++ b/core/modules/user/migration_templates/user_profile_field.yml @@ -32,4 +32,4 @@ process: map: list: -1 destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config diff --git a/core/modules/user/src/Plugin/migrate/destination/EntityUser.php b/core/modules/user/src/Plugin/migrate/destination/EntityUser.php index b11d867..46dd0c6 100644 --- a/core/modules/user/src/Plugin/migrate/destination/EntityUser.php +++ b/core/modules/user/src/Plugin/migrate/destination/EntityUser.php @@ -9,7 +9,6 @@ use Drupal\Core\Field\FieldTypePluginManagerInterface; use Drupal\Core\Field\Plugin\Field\FieldType\EmailItem; use Drupal\Core\Password\PasswordInterface; -use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Plugin\migrate\destination\EntityContentBase; use Drupal\migrate\Row; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -37,8 +36,6 @@ class EntityUser extends EntityContentBase { * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * The migration. * @param EntityStorageInterface $storage * The storage for this entity type. * @param array $bundles @@ -50,21 +47,20 @@ class EntityUser extends EntityContentBase { * @param \Drupal\Core\Password\PasswordInterface $password * The password service. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, PasswordInterface $password) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $entity_manager, $field_type_manager); + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, PasswordInterface $password) { + parent::__construct($configuration, $plugin_id, $plugin_definition, $storage, $bundles, $entity_manager, $field_type_manager); $this->password = $password; } /** * {@inheritdoc} */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { $entity_type = static::getEntityTypeId($plugin_id); return new static( $configuration, $plugin_id, $plugin_definition, - $migration, $container->get('entity.manager')->getStorage($entity_type), array_keys($container->get('entity.manager')->getBundleInfo($entity_type)), $container->get('entity.manager'), diff --git a/core/modules/user/src/Plugin/migrate/destination/UserData.php b/core/modules/user/src/Plugin/migrate/destination/UserData.php index 6ca6017..58ddf1b 100644 --- a/core/modules/user/src/Plugin/migrate/destination/UserData.php +++ b/core/modules/user/src/Plugin/migrate/destination/UserData.php @@ -30,25 +30,22 @@ class UserData extends DestinationBase implements ContainerFactoryPluginInterfac * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * The migration. * @param \Drupal\user\UserData $user_data * The user data service. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, UserDataStorage $user_data) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration); + public function __construct(array $configuration, $plugin_id, $plugin_definition, UserDataStorage $user_data) { + parent::__construct($configuration, $plugin_id, $plugin_definition); $this->userData = $user_data; } /** * {@inheritdoc} */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $configuration, $plugin_id, $plugin_definition, - $migration, $container->get('user.data') ); }