diff --git a/core/modules/migrate/src/Entity/Migration.php b/core/modules/migrate/src/Entity/Migration.php index 102098a..be69b2b 100644 --- a/core/modules/migrate/src/Entity/Migration.php +++ b/core/modules/migrate/src/Entity/Migration.php @@ -134,7 +134,7 @@ class Migration extends ConfigEntityBase implements MigrationInterface, Requirem * * @var array */ - protected $sourceIds = array(); + protected $sourceIds = []; /** * The destination identifiers. @@ -144,7 +144,7 @@ class Migration extends ConfigEntityBase implements MigrationInterface, Requirem * * @var array */ - protected $destinationIds = FALSE; + protected $destinationIds = []; /** * Information on the high water mark. @@ -179,6 +179,8 @@ class Migration extends ConfigEntityBase implements MigrationInterface, Requirem protected $highWaterStorage; /** + * Track time of last import if TRUE. + * * @var bool */ protected $trackLastImported = FALSE; @@ -188,14 +190,14 @@ class Migration extends ConfigEntityBase implements MigrationInterface, Requirem * * @var array */ - protected $requirements = array(); + protected $requirements = []; /** * These migrations, if ran at all, must be executed before this migration. * * @var array */ - protected $migration_dependencies = array(); + protected $migration_dependencies = []; /** * The entity manager. @@ -382,4 +384,66 @@ public function isComplete() { return $this->getMigrationResult() === static::RESULT_COMPLETED; } + /** + * {@inheritdoc} + */ + public function getProcess() { + return $this->get('process'); + } + + /** + * {@inheritdoc} + */ + public function setProcess(array $process) { + $this->set('process', $process); + } + + /** + * {@inheritdoc} + */ + public function getSystemOfRecord() { + return $this->get('systemOfRecord'); + } + + /** + * {@inheritdoc} + */ + public function isTrackLastImported() { + return $this->get('trackLastImported'); + } + + /** + * {@inheritdoc} + */ + public function getSource() { + return $this->get('source'); + } + + /** + * {@inheritdoc} + */ + public function setSource(array $source) { + $this->set('source', $source); + } + + /** + * {@inheritdoc} + */ + public function getDestination() { + return $this->get('destination'); + } + + /** + * {@inheritdoc} + */ + public function setDestination(array $destination) { + $this->set('destination', $destination); + } + + /** + * {@inheritdoc} + */ + public function getMigrationDependencies() { + return $this->get('migration_dependencies'); + } } diff --git a/core/modules/migrate/src/Entity/MigrationInterface.php b/core/modules/migrate/src/Entity/MigrationInterface.php index 4bfb89f..2904fb0 100644 --- a/core/modules/migrate/src/Entity/MigrationInterface.php +++ b/core/modules/migrate/src/Entity/MigrationInterface.php @@ -179,4 +179,76 @@ public function setMigrationResult($result); */ public function getMigrationResult(); + /** + * Get the current configuration describing the process plugins. + * + * @return array + * The configuration describing the process plugins. + */ + public function getProcess(); + + /** + * Set the current configuration describing the process plugins. + * + * @param array $process + * The configuration describing the process plugins. + */ + public function setProcess(array $process); + + /** + * Get the current system of record of the migration. + * + * @return string + * The current system of record of the migration. + */ + public function getSystemOfRecord(); + + /** + * Checks if the migration should track time of last import. + * + * @return bool + * TRUE if the migration is tracking last import time. + */ + public function isTrackLastImported(); + + /** + * Get the source configuration of this migration. + * + * @return array + * The current source configuration. + */ + public function getSource(); + + /** + * Set the source configuration of this migration. + * + * @param array $source + * The source configuration, with at least a 'plugin' key. + */ + public function setSource(array $source); + + /** + * Get the destination configuration of this migration. + * + * @return array + * The current destination configuration. + */ + public function getDestination(); + + /** + * Set the current configuration describing the process plugins. + * + * @param array $destination + * The destination configuration, with at least a 'plugin' key. + */ + public function setDestination(array $destination); + + /** + * Get the dependencies for this migration. + * + * @return array + * The dependencies for this migrations. + */ + public function getMigrationDependencies(); + } diff --git a/core/modules/migrate/src/MigrationStorage.php b/core/modules/migrate/src/MigrationStorage.php index cf11dd4..3d0454e 100644 --- a/core/modules/migrate/src/MigrationStorage.php +++ b/core/modules/migrate/src/MigrationStorage.php @@ -31,7 +31,7 @@ public function buildDependencyMigration(array $migrations, array $dynamic_ids) $id = $migration->id(); $requirements[$id] = array(); $dependency_graph[$id]['edges'] = array(); - $migration_dependencies = $migration->get('migration_dependencies'); + $migration_dependencies = $migration->getMigrationDependencies(); if (isset($migration_dependencies['required'])) { foreach ($migration_dependencies['required'] as $dependency) { diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php b/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php index adc6ff6..9508688 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php @@ -92,7 +92,7 @@ public function loadMultiple(EntityStorageInterface $storage, array $sub_ids = N // Specifically process the link field until core is fixed. // @see https://www.drupal.org/node/2235457 if ($data['type'] == 'link') { - $process = $migration->get('process'); + $process = $migration->getProcess(); $process[$field_name] = [ 'plugin' => 'd6_cck_link', 'source' => [ @@ -101,18 +101,18 @@ public function loadMultiple(EntityStorageInterface $storage, array $sub_ids = N $field_name . '_attributes', ], ]; - $migration->set('process', $process); + $migration->setProcess($process); } else { - $process = $migration->get('process'); + $process = $migration->getProcess(); $process[$field_name] = $field_name; - $migration->set('process', $process); + $migration->setProcess($process); } } } else { $fields = array_keys($migration->getSourcePlugin()->fields()); - $migration->set('process', $migration->get('process') + array_combine($fields, $fields)); + $migration->setProcess($migration->getProcess() + array_combine($fields, $fields)); } $migrations[$migration->id()] = $migration; } diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateFileTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateFileTest.php index b613f19..22b8e9f 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFileTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateFileTest.php @@ -32,11 +32,11 @@ protected function setUp() { $dumps = array( $this->getDumpDirectory() . '/Drupal6File.php', ); - /** @var \Drupal\migrate\entity\Migration $migration */ + /** @var \Drupal\migrate\Entity\MigrationInterface $migration */ $migration = entity_load('migration', 'd6_file'); - $source = $migration->get('source'); + $source = $migration->getSource(); $source['conf_path'] = 'core/modules/simpletest'; - $migration->set('source', $source); + $migration->setSource($source); $this->prepare($migration, $dumps); $executable = new MigrateExecutable($migration, $this); $executable->import(); diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureFileTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureFileTest.php index 16e8e1b..018cd69 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureFileTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserPictureFileTest.php @@ -32,11 +32,11 @@ protected function setUp() { $dumps = array( $this->getDumpDirectory() . '/Drupal6User.php', ); - /** @var \Drupal\migrate\entity\Migration $migration */ + /** @var \Drupal\migrate\Entity\MigrationInterface $migration */ $migration = entity_load('migration', 'd6_user_picture_file'); - $source = $migration->get('source'); + $source = $migration->getSource(); $source['conf_path'] = 'core/modules/simpletest'; - $migration->set('source', $source); + $migration->setSource($source); $this->prepare($migration, $dumps); $executable = new MigrateExecutable($migration, $this); $executable->import();