Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / migrate_plus / src / Plugin / migrate / process / Merge.php
index 1e0467917ca28f143019d56c295ec064e20d5f29..463595e9d7b31c13bd6e7e4dc3a799d28ac1dff4 100644 (file)
@@ -41,8 +41,8 @@ use Drupal\migrate\Row;
  *    paragraphs_field:
  *      plugin: merge
  *      source:
- *        - @temp_body
- *        - @temp_images
+ *        - '@temp_body'
+ *        - '@temp_images'
  *  destination:
  *    plugin: 'entity:node'
  */
@@ -53,12 +53,12 @@ class Merge extends ProcessPluginBase {
    */
   public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
     if (!is_array($value)) {
-      throw new MigrateException('Input should be an array.');
+      throw new MigrateException(sprintf('Merge process failed for destination property (%s): input is not an array.', $destination_property));
     }
     $new_value = [];
-    foreach ($value as $item) {
+    foreach($value as $i => $item) {
       if (!is_array($item)) {
-        throw new MigrateException('One of the items is not an array that can be merged.');
+        throw new MigrateException(sprintf('Merge process failed for destination property (%s): index (%s) in the source value is not an array that can be merged.', $destination_property, $i));
       }
       $new_value = array_merge($new_value, $item);
     }