diff --git a/src/Plugin/migrate/Derivative/MigrateReferenceRevision.php b/src/Plugin/migrate/Derivative/MigrateReferenceRevision.php new file mode 100644 index 0000000..39ebc08 --- /dev/null +++ b/src/Plugin/migrate/Derivative/MigrateReferenceRevision.php @@ -0,0 +1,26 @@ +entityDefinitions as $entity_type => $entity_info) { + if ($entity_info->getKey('revision')) { + $this->derivatives[$entity_type] = array( + 'id' => "entity_revision:$entity_type", + 'class' => EntityReferenceRevisions::class, + 'requirements_met' => 1, + 'provider' => $entity_info->getProvider(), + ); + } + } + return $this->derivatives; + } + +} diff --git a/src/Plugin/migrate/destination/EntityReferenceRevisions.php b/src/Plugin/migrate/destination/EntityReferenceRevisions.php new file mode 100644 index 0000000..cb4614c --- /dev/null +++ b/src/Plugin/migrate/destination/EntityReferenceRevisions.php @@ -0,0 +1,56 @@ +save(); + + return [ + $this->getKey('id') => $entity->id(), + $this->getKey('revision') => $entity->getRevisionId(), + ]; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids = parent::getIds(); + + // TODO: Improve after https://www.drupal.org/node/2783715 is finished. + $ids[$this->getKey('revision')]['type'] = 'string'; + + return $ids; + } + +}