diff --git a/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php b/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php index 2ff4a36..89f4ad7 100644 --- a/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php +++ b/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php @@ -9,7 +9,6 @@ use Drupal\ban\BanIpManagerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\migrate\Entity\MigrationInterface; use Drupal\migrate\Plugin\migrate\destination\DestinationBase; use Drupal\migrate\Row; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -39,25 +38,22 @@ class BlockedIP extends DestinationBase implements ContainerFactoryPluginInterfa * The plugin ID. * @param mixed $plugin_definition * The plugin definiiton. - * @param \Drupal\migrate\Entity\MigrationInterface $migration - * The current migration. * @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') ); } @@ -72,7 +68,7 @@ public function getIds() { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { return [ 'ip' => $this->t('The blocked IP address.'), ]; diff --git a/core/modules/comment/migration_templates/d6_comment_field.yml b/core/modules/comment/migration_templates/d6_comment_field.yml index 469d604..1084ae9 100644 --- a/core/modules/comment/migration_templates/d6_comment_field.yml +++ b/core/modules/comment/migration_templates/d6_comment_field.yml @@ -13,7 +13,7 @@ process: type: 'constants/type' 'settings/comment_type': comment_type destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config 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 7ebbc83..ed0d5a7 100644 --- a/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php +++ b/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php @@ -12,7 +12,6 @@ use Drupal\Core\Entity\Query\QueryFactory; use Drupal\Core\Field\FieldTypePluginManagerInterface; use Drupal\Core\State\StateInterface; -use Drupal\migrate\Entity\MigrationInterface; use Drupal\migrate\MigrateException; use Drupal\migrate\Plugin\migrate\destination\EntityContentBase; use Drupal\migrate\Row; @@ -55,8 +54,6 @@ class EntityComment extends EntityContentBase { * 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 @@ -70,8 +67,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,13 +76,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 = 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/field/migration_templates/d6_field.yml b/core/modules/field/migration_templates/d6_field.yml index ec29aad..b7ff386 100644 --- a/core/modules/field/migration_templates/d6_field.yml +++ b/core/modules/field/migration_templates/d6_field.yml @@ -129,4 +129,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..ea438dc 100644 --- a/core/modules/file/migration_templates/d6_upload_field.yml +++ b/core/modules/file/migration_templates/d6_upload_field.yml @@ -20,4 +20,4 @@ process: cardinality: 'constants/cardinality' 'settings/display_field': 'constants/display_field' destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config diff --git a/core/modules/file/src/Plugin/migrate/destination/EntityFile.php b/core/modules/file/src/Plugin/migrate/destination/EntityFile.php index 576b38b..e6f4f00 100644 --- a/core/modules/file/src/Plugin/migrate/destination/EntityFile.php +++ b/core/modules/file/src/Plugin/migrate/destination/EntityFile.php @@ -14,7 +14,6 @@ use Drupal\Core\File\FileSystemInterface; use Drupal\Core\StreamWrapper\LocalStream; use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface; -use Drupal\migrate\Entity\MigrationInterface; use Drupal\migrate\Row; use Drupal\migrate\MigrateException; use Drupal\migrate\Plugin\migrate\destination\EntityContentBase; @@ -43,7 +42,7 @@ class EntityFile extends EntityContentBase { /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, StreamWrapperManagerInterface $stream_wrappers, FileSystemInterface $file_system) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, StreamWrapperManagerInterface $stream_wrappers, FileSystemInterface $file_system) { $configuration += array( 'source_base_path' => '', 'source_path_property' => 'filepath', @@ -51,7 +50,8 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition 'move' => FALSE, 'urlencode' => FALSE, ); - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $entity_manager, $field_type_manager); + + parent::__construct($configuration, $plugin_id, $plugin_definition, $storage, $bundles, $entity_manager, $field_type_manager); $this->streamWrapperManager = $stream_wrappers; $this->fileSystem = $file_system; @@ -60,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 = 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/migrate/src/Entity/Migration.php b/core/modules/migrate/src/Entity/Migration.php index 094713d..5c9bc8d 100644 --- a/core/modules/migrate/src/Entity/Migration.php +++ b/core/modules/migrate/src/Entity/Migration.php @@ -324,7 +324,7 @@ public function getDestinationPlugin($stub_being_requested = FALSE) { if ($stub_being_requested && !empty($this->destination['no_stub'])) { throw new MigrateSkipRowException; } - $this->destinationPlugin = \Drupal::service('plugin.manager.migrate.destination')->createInstance($this->destination['plugin'], $this->destination, $this); + $this->destinationPlugin = \Drupal::service('plugin.manager.migrate.destination')->createInstance($this->destination['plugin'], $this->destination); } return $this->destinationPlugin; } diff --git a/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php b/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php index 8134883..dc80618 100644 --- a/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php +++ b/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php @@ -8,7 +8,6 @@ namespace Drupal\migrate\Plugin; use Drupal\Component\Plugin\PluginInspectionInterface; -use Drupal\migrate\Entity\MigrationInterface; use Drupal\migrate\Row; /** @@ -43,17 +42,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? - * - * @param \Drupal\migrate\Entity\MigrationInterface $migration - * (optional) the migration containing this destination. - * * @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 96f7be5..a6f8322 100644 --- a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php +++ b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php @@ -8,10 +8,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\migrate\Entity\MigrationInterface; +use Drupal\Core\Plugin\DefaultPluginManager; /** * Plugin manager for migrate destination plugins. @@ -23,7 +24,7 @@ * * @ingroup migration */ -class MigrateDestinationPluginManager extends MigratePluginManager { +class MigrateDestinationPluginManager extends DefaultPluginManager { /** * The entity manager. @@ -36,8 +37,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. @@ -51,20 +51,30 @@ class MigrateDestinationPluginManager extends MigratePluginManager { * The annotation class name. */ 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) { + public function createInstance($plugin_id, array $configuration = array()) { 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); + $plugin_definition = $this->getDefinition($plugin_id); + $plugin_class = DefaultFactory::getPluginClass($plugin_id, $plugin_definition); + // If the plugin provides a factory method, pass the container to it. + if (is_subclass_of($plugin_class, 'Drupal\Core\Plugin\ContainerFactoryPluginInterface')) { + $plugin = $plugin_class::create(\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition); + } + else { + $plugin = new $plugin_class($configuration, $plugin_id, $plugin_definition); + } + return $plugin; } } diff --git a/core/modules/migrate/src/Plugin/migrate/destination/Config.php b/core/modules/migrate/src/Plugin/migrate/destination/Config.php index 748f1a8..66a43df 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/Config.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/Config.php @@ -14,6 +14,7 @@ use Drupal\Core\Entity\DependencyTrait; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\migrate\Entity\MigrationInterface; +use Drupal\migrate\MigrateException; use Drupal\migrate\Row; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -46,25 +47,22 @@ class Config extends DestinationBase implements ContainerFactoryPluginInterface, * The plugin ID for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param \Drupal\migrate\Entity\MigrationInterface $migration - * The migration entity. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The configuration factory. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, ConfigFactoryInterface $config_factory) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration); + public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory) { + parent::__construct($configuration, $plugin_id, $plugin_definition); $this->config = $config_factory->getEditable($configuration['config_name']); } /** * {@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('config.factory') ); } diff --git a/core/modules/migrate/src/Plugin/migrate/destination/DestinationBase.php b/core/modules/migrate/src/Plugin/migrate/destination/DestinationBase.php index 93f3b83..304f78b 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/DestinationBase.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/DestinationBase.php @@ -5,11 +5,9 @@ * Contains \Drupal\migrate\Plugin\migrate\destination\DestinationBase. */ - namespace Drupal\migrate\Plugin\migrate\destination; use Drupal\Core\Plugin\PluginBase; -use Drupal\migrate\Entity\MigrationInterface; use Drupal\migrate\Exception\RequirementsException; use Drupal\migrate\Plugin\MigrateDestinationInterface; use Drupal\migrate\Plugin\MigrateIdMapInterface; @@ -42,30 +40,6 @@ protected $rollbackAction = MigrateIdMapInterface::ROLLBACK_DELETE; /** - * The migration. - * - * @var \Drupal\migrate\Entity\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 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 f7a6a1e..89fd226 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/Entity.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/Entity.php @@ -11,7 +11,6 @@ use Drupal\Core\Entity\DependencyTrait; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\migrate\Entity\MigrationInterface; use Drupal\migrate\Row; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -47,15 +46,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; @@ -64,13 +61,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)) ); @@ -93,7 +89,7 @@ protected static function getEntityTypeId($plugin_id) { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { // TODO: Implement fields() method. } diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php index 4dfd6c6..d6ea10d 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php @@ -50,8 +50,6 @@ class EntityContentBase extends Entity { * The plugin ID for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param \Drupal\migrate\Entity\MigrationInterface $migration - * The migration entity. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The storage for this entity type. * @param array $bundles @@ -61,8 +59,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; } @@ -70,13 +68,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 = 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/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 984560b..7fbb0d0 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 @@ -7,7 +7,6 @@ namespace Drupal\migrate_events_test\Plugin\migrate\destination; -use Drupal\migrate\Entity\MigrationInterface; use Drupal\migrate\Plugin\migrate\destination\DestinationBase; use Drupal\migrate\Row; @@ -30,7 +29,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/destination/ConfigTest.php b/core/modules/migrate/tests/src/Unit/destination/ConfigTest.php index 363e4f1..7c70024 100644 --- a/core/modules/migrate/tests/src/Unit/destination/ConfigTest.php +++ b/core/modules/migrate/tests/src/Unit/destination/ConfigTest.php @@ -23,9 +23,6 @@ public function testImport() { $source = array( 'test' => 'x', ); - $migration = $this->getMockBuilder('Drupal\migrate\Entity\Migration') - ->disableOriginalConstructor() - ->getMock(); $config = $this->getMockBuilder('Drupal\Core\Config\Config') ->disableOriginalConstructor() ->getMock(); @@ -51,7 +48,7 @@ public function testImport() { $row->expects($this->once()) ->method('getRawDestination') ->will($this->returnValue($source)); - $destination = new Config(array('config_name' => 'd8_config'), 'd8_config', array('pluginId' => 'd8_config'), $migration, $config_factory); + $destination = new Config(array('config_name' => 'd8_config'), 'd8_config', array('pluginId' => 'd8_config'), $config_factory); $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 2db5d9e..b077ff3 100644 --- a/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php +++ b/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php @@ -186,7 +186,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 deleted file mode 100644 index 50b004c..0000000 --- a/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php +++ /dev/null @@ -1,93 +0,0 @@ -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->get('source'); - 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'; - } - -} diff --git a/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php b/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php index 20b2c31..3c5cc74 100644 --- a/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php +++ b/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php @@ -8,7 +8,6 @@ namespace Drupal\path\Plugin\migrate\destination; use Drupal\Core\Path\AliasStorage; -use Drupal\migrate\Entity\MigrationInterface; use Drupal\migrate\Row; use Drupal\migrate\Plugin\migrate\destination\DestinationBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -37,25 +36,22 @@ class UrlAlias extends DestinationBase implements ContainerFactoryPluginInterfac * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param 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; } /** * {@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('path.alias_storage') ); } @@ -86,7 +82,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 557fea3..e0f0d93 100644 --- a/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php +++ b/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php @@ -38,25 +38,22 @@ class ShortcutSetUsers extends DestinationBase implements ContainerFactoryPlugin * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param 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 5139f31..4f7f595 100644 --- a/core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml +++ b/core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml @@ -23,7 +23,7 @@ process: 'settings/target_type': 'constants/target_entity_type' cardinality: 'constants/cardinality' destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config 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..0457c57 100644 --- a/core/modules/user/migration_templates/user_picture_field.yml +++ b/core/modules/user/migration_templates/user_picture_field.yml @@ -18,4 +18,4 @@ process: type: 'constants/type' cardinality: 'constants/cardinality' destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config 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 beda7c8..362bb83 100644 --- a/core/modules/user/src/Plugin/migrate/destination/EntityUser.php +++ b/core/modules/user/src/Plugin/migrate/destination/EntityUser.php @@ -13,7 +13,6 @@ use Drupal\Core\Field\FieldTypePluginManagerInterface; use Drupal\Core\Field\Plugin\Field\FieldType\EmailItem; use Drupal\Core\Password\PasswordInterface; -use Drupal\migrate\Entity\MigrationInterface; use Drupal\migrate\MigrateException; use Drupal\user\MigratePassword; use Drupal\migrate\Plugin\migrate\destination\EntityContentBase; @@ -43,8 +42,6 @@ class EntityUser extends EntityContentBase { * 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 @@ -58,8 +55,8 @@ 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); if (isset($configuration['md5_passwords'])) { $this->password = $password; } @@ -68,13 +65,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 = 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 5ae639f..a5a30a1 100644 --- a/core/modules/user/src/Plugin/migrate/destination/UserData.php +++ b/core/modules/user/src/Plugin/migrate/destination/UserData.php @@ -7,7 +7,6 @@ namespace Drupal\user\Plugin\migrate\destination; -use Drupal\migrate\Entity\MigrationInterface; use Drupal\user\UserData as UserDataStorage; use Drupal\migrate\Row; use Drupal\migrate\Plugin\migrate\destination\DestinationBase; @@ -35,25 +34,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\Entity\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') ); } @@ -83,7 +79,7 @@ public function getIds() { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { return [ 'uid' => 'The user id.', 'module' => 'The module name responsible for the settings.',