Created
November 6, 2018 10:12
-
-
Save xurizaemon/7b8fe27dfdd444aa90a3ac8a79f94e51 to your computer and use it in GitHub Desktop.
transforming uid=1 to uid=3, leave the rest the same
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source: | |
plugin: d6_node | |
node_type: ao | |
process: | |
title: title | |
uid: | |
plugin: transform_uid | |
source: node_uid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\foo_migrate\Plugin\migrate\process; | |
use Drupal\migrate\ProcessPluginBase; | |
use Drupal\migrate\MigrateExecutableInterface; | |
use Drupal\migrate\Row; | |
/** | |
* Replace uid=1 with uid=3 | |
* | |
* @MigrateProcessPlugin( | |
* id = "transform_uid" | |
* ) | |
*/ | |
class TransformUid extends ProcessPluginBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { | |
return ($value == 1) ? 3 : $value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment