CommerceReferenceRevision.php in Commerce Migrate 3.1.x
File
src/Plugin/migrate/process/CommerceReferenceRevision.php
View source
<?php
namespace Drupal\commerce_migrate\Plugin\migrate\process;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Plugin\migrate\process\MigrationLookup;
use Drupal\migrate\Row;
class CommerceReferenceRevision extends MigrationLookup {
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!is_array($value)) {
$value = [
$value,
];
}
$ids = parent::transform($value, $migrate_executable, $row, $destination_property);
$target_id = $ids[0];
$revision_id = $ids[1];
return [
'target_id' => $target_id,
'target_revision_id' => $revision_id,
];
}
}