Skip to content

Instantly share code, notes, and snippets.

@jmolivas
Last active October 26, 2016 15:27
Show Gist options
  • Save jmolivas/c998089c6ccfcebcb1b255c5ac51d928 to your computer and use it in GitHub Desktop.
Save jmolivas/c998089c6ccfcebcb1b255c5ac51d928 to your computer and use it in GitHub Desktop.
Drupal 8 migration validate `NULL` since is read as string
<?php
// ...
public function onPrepareRow(MigratePrepareRowEvent $event) {
$row = $event->getRow();
$fields = $event->getMigration()->getPluginDefinition()['process'];
foreach ($fields as $destination => $source) {
if (!is_array($destination) && !is_array($source)) {
if ($row->getSourceProperty($source) == "NULL") {
$row->setSourceProperty($source, NULL);
}
}
}
}
// ...
@jmolivas
Copy link
Author

@heddn awesome I will make the changes and reply you back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment