Score:0

Passed variable is not an array or object

cn flag

Trying to migrate images by copying them from an external source:

id: custom_news_migration_with_external_images_1
label: custom news migration with external images importer
source:
  plugin: embedded_data
  ids:
    id:
      type: integer
  constants: file_destination: /home/ip/c921/web/sites/default/files/images #absolute path ... default 'public://images'
process:
  nid: id
  title: title
  field_news_image:
    plugin: image_import
    source: file
    destination: 'constants/file_destination'
    title: file_title
    alt: title
destination:
  plugin: entity:node
  default_bundle: news 

The error I continually get in the console is:

[error] ... Passed variable is not an array or object in /home/ip/c921/web/core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php Zeile 96

Code snippet:

     92   /**
     93    * {@inheritdoc}
     94    */
     95   public function initializeIterator() {
     96     return new \ArrayIterator($this->dataRows);
     97   }

Forgot to mention that the drupal.org example has data_rows entries:


  data_rows:
    -
      id: 1
      title: 'Page 1 title'
      file: 'https://www.drupal.org/files/druplicon-small.png'
      file_title: 'Druplicon logo'  
    -
      id: 2
      title: 'Page 2 title'
      file: 'https://www.drupal.org/files/drupal_logo-blue.png'
      file_title: 'Drupal logo'

I didn't use them. Because I want to migrate thousends of images.

The basic example is from drupal.org

Help would be great.

miststudent2011 avatar
fr flag
Can you update your question with sample source data?
misterdidi avatar
de flag
Aren't you missing the data_rows entry in your .yml config file? I may be wrong but I'd try to write a script to populate the .yml file data_rows entry with the thousands of image references.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.