Skip to content

Instantly share code, notes, and snippets.

@Oleksii909
Created June 9, 2023 07:48
Show Gist options
  • Save Oleksii909/3d4219f23d55d49c64741f892f67e0bc to your computer and use it in GitHub Desktop.
Save Oleksii909/3d4219f23d55d49c64741f892f67e0bc to your computer and use it in GitHub Desktop.
<?php
// JSONPath converts JSON objects to PHP objects which cause Migrate to
// fail when using the SubProcess process plugin. This function
// recursively converts those objects to arrays to prevent this issue.
$toArray = function ($x) use (&$toArray) {
return (is_scalar($x) || is_null($x)) ? $x : array_map($toArray, (array) $x);
};
$field_data = $toArray($field_data);
$this->currentItem[$field_name] = $field_data;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment