Commit 529c16e0 authored by catch's avatar catch
Browse files

Issue #3110315 by Hardik_Patel_12, Gábor Hojtsy, andypost, longwave,...

Issue #3110315 by Hardik_Patel_12, Gábor Hojtsy, andypost, longwave, mpdonadio: Remove all @deprecated code from migrate_drupal module
parent fbde66e1
<?php
namespace Drupal\Tests\datetime\Unit\Plugin\migrate\field;
use Drupal\datetime\Plugin\migrate\field\DateField;
use Drupal\migrate\MigrateException;
use Drupal\Tests\UnitTestCase;
/**
* Tests legacy methods on the date_field plugin.
*
* @group migrate
* @group legacy
*/
class DateFieldLegacyTest extends UnitTestCase {
/**
* Tests deprecation on calling processFieldValues().
*
* @expectedDeprecation Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use defineValueProcessPipeline() instead. See https://www.drupal.org/node/2944598.
*/
public function testUnknownDateType() {
$migration = $this->prophesize('Drupal\migrate\Plugin\MigrationInterface')->reveal();
$plugin = new DateField([], '', []);
$this->expectException(MigrateException::class);
$this->expectExceptionMessage("Field field_date of type 'timestamp' is an unknown date field type.");
$plugin->processFieldValues($migration, 'field_date', ['type' => 'timestamp']);
}
}
<?php
namespace Drupal\migrate_drupal;
/**
* @deprecated in drupal:8.1.0 and is removed from drupal:9.0.0. Use
* \Drupal\migrate_drupal\MigrationConfigurationTrait instead.
*
* @see https://www.drupal.org/node/2873794
*/
trait MigrationCreationTrait {
use MigrationConfigurationTrait;
}
......@@ -15,16 +15,6 @@
*/
class FieldMigration extends Migration implements ContainerFactoryPluginInterface {
/**
* Defines which configuration option has the migration processing function.
*
* Default method is 'field_plugin_method'.
*
* @const string
* @deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use the migrate_drupal.field_discovery service instead. See https://www.drupal.org/node/3006076.
*/
const PLUGIN_METHOD = 'field_plugin_method';
/**
* Flag indicating whether the field data has been filled already.
*
......
<?php
namespace Drupal\migrate_drupal\Plugin\migrate\destination;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\FieldTypePluginManagerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig as BaseEntityFieldStorageConfig;
/**
* Deprecated. Destination with Drupal specific config dependencies.
*
* @MigrateDestination(
* id = "md_entity:field_storage_config"
* )
*
* @deprecated in drupal:8.2.0 and is removed from drupal:9.0.0. 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 \Drupal\Core\Entity\EntityStorageInterface $storage
* The storage for this entity type.
* @param array $bundles
* The list of bundles this entity type has.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The configuration factory.
* @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, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, FieldTypePluginManagerInterface $field_type_plugin_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $language_manager, $config_factory, $field_type_plugin_manager);
$this->languageManager = $language_manager;
$this->configFactory = $config_factory;
$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_type.manager')->getStorage($entity_type_id),
array_keys($container->get('entity_type.bundle.info')->getBundleInfo($entity_type_id)),
$container->get('language_manager'),
$container->get('config.factory'),
$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';
}
}
......@@ -19,20 +19,6 @@
*/
abstract class FieldPluginBase extends PluginBase implements MigrateFieldInterface {
/**
* Alters the migration for field definitions.
*
* @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use
* alterFieldMigration() instead.
*
* @see https://www.drupal.org/node/2944598
* @see ::alterFieldMigration()
*/
public function processField(MigrationInterface $migration) {
@trigger_error('Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use alterFieldMigration() instead. See https://www.drupal.org/node/2944598.', E_USER_DEPRECATED);
$this->alterFieldMigration($migration);
}
/**
* {@inheritdoc}
*/
......@@ -41,20 +27,6 @@ public function alterFieldMigration(MigrationInterface $migration) {
$migration->mergeProcessOfProperty('type', $process);
}
/**
* Alert field instance migration.
*
* @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use
* alterFieldInstanceMigration() instead.
*
* @see https://www.drupal.org/node/2944598
* @see ::alterFieldInstanceMigration()
*/
public function processFieldInstance(MigrationInterface $migration) {
@trigger_error('Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use alterFieldInstanceMigration() instead. See https://www.drupal.org/node/2944598.', E_USER_DEPRECATED);
$this->alterFieldInstanceMigration($migration);
}
/**
* {@inheritdoc}
*/
......@@ -62,20 +34,6 @@ public function alterFieldInstanceMigration(MigrationInterface $migration) {
// Nothing to do by default with field instances.
}
/**
* Alter field widget migration.
*
* @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use
* alterFieldWidgetMigration() instead.
*
* @see https://www.drupal.org/node/2944598
* @see ::alterFieldWidgetMigration()
*/
public function processFieldWidget(MigrationInterface $migration) {
@trigger_error('Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use alterFieldWidgetMigration() instead. See https://www.drupal.org/node/2944598.', E_USER_DEPRECATED);
$this->alterFieldWidgetMigration($migration);
}
/**
* {@inheritdoc}
*/
......@@ -118,20 +76,6 @@ public function getFieldWidgetMap() {
];
}
/**
* Alter field formatter migration.
*
* @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use
* alterFieldFormatterMigration() instead.
*
* @see https://www.drupal.org/node/2944598
* @see ::processFieldFormatter()
*/
public function processFieldFormatter(MigrationInterface $migration) {
@trigger_error('Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use alterFieldFormatterMigration() instead. See https://www.drupal.org/node/2944598.', E_USER_DEPRECATED);
$this->alterFieldFormatterMigration($migration);
}
/**
* {@inheritdoc}
*/
......@@ -147,20 +91,6 @@ public function alterFieldFormatterMigration(MigrationInterface $migration) {
$migration->mergeProcessOfProperty('options/type', $process);
}
/**
* Defines the process pipeline for field values.
*
* @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use
* defineValueProcessPipeline() instead.
*
* @see https://www.drupal.org/node/2944598
* @see ::defineValueProcessPipeline()
*/
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
@trigger_error('Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use defineValueProcessPipeline() instead. See https://www.drupal.org/node/2944598.', E_USER_DEPRECATED);
return $this->defineValueProcessPipeline($migration, $field_name, $data);
}
/**
* {@inheritdoc}
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment