Created
June 9, 2023 07:48
-
-
Save Oleksii909/3d4219f23d55d49c64741f892f67e0bc to your computer and use it in GitHub Desktop.
JSONPath converts JSON objects to PHP objects from https://www.drupal.org/files/issues/2022-10-28/migrate_plus-json-xpath-filtering-3007709-40.patch
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 | |
// 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