I am new to writing migrations. I am attempting to figure it out with what I thought was simple case of migrating a title into a content type from a single xml file. The file has been uploaded to /sites/default/files/feeds/NCT00001239.xml. This is on D 8.7.4
When I run the migration I get the error posted below. Here is the migration yml file:
id: clinical_trial_migrate
label: Clinical-Trial-Migrate
source:
# XML data parser
plugin: url
data_fetcher_plugin: file
data_parser_plugin: xml
urls: public://NCT00001239.xml
item_selector: /clinical_study
fields:
-
name: title
label: title
selector: official_title
process:
# nid and vid commented out will allow them to autoincrement. Safe
as long
# as nothing else is referencing them.
# nid: nid
# vid: vid
Title: title
type:
plugin: default_value
default_value: clinical_trial_record
langcode:
plugin: default_value
source: language
default_value: "und"
uid:
plugin: default_value
default_value: 1
destination:
plugin: entity:nodeHere is the error:
Invalid argument supplied for foreach() DataParserPluginBase.php:121 [warning]
TypeError: Argument 2 passed to Drupal\migrate\Row::__construct() [error]
must be of the type array, null given, called in
/Applications/MAMP/htdocs/CP8/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php
on line 357 in Drupal\migrate\Row->__construct() (line 101 of
/Applications/MAMP/htdocs/CP8/core/modules/migrate/src/Row.php) #0
/Applications/MAMP/htdocs/CP8/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php(357):
Drupal\migrate\Row->__construct(Array, NULL)
#1
/Applications/MAMP/htdocs/CP8/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php(330):
Drupal\migrate\Plugin\migrate\source\SourcePluginBase->next()
#2 [internal function]:
Drupal\migrate\Plugin\migrate\source\SourcePluginBase->rewind()
#3
/Applications/MAMP/htdocs/CP8/core/modules/migrate/src/MigrateExecutable.php(188):
FilterIterator->rewind()
#4
/Users/JG/.composer/vendor/drush/drush/includes/drush.inc(720):
Drupal\migrate\MigrateExecutable->import()
#5
/Users/JG/.composer/vendor/drush/drush/includes/drush.inc(711):
drush_call_user_func_array(Array, Array)
#6
/Applications/MAMP/htdocs/CP8/modules/migrate_tools/migrate_tools.drush.inc(317):
drush_op(Array)
#7 [internal function]:
_drush_migrate_tools_execute_migration(Object(Drupal\migrate\Plugin\Migration),
'clinical_trial_...', Array)
#8
/Applications/MAMP/htdocs/CP8/modules/migrate_tools/migrate_tools.drush.inc(272):
array_walk(Array, '_drush_migrate_...', Array)
#9
/Users/JG/.composer/vendor/drush/drush/includes/command.inc(422):
drush_migrate_tools_migrate_import('clinical_trial_...')
#10
/Users/JG/.composer/vendor/drush/drush/includes/command.inc(231):
_drush_invoke_hooks(Array, Array)
#11
/Users/JG/.composer/vendor/drush/drush/includes/command.inc(199):
drush_command('clinical_trial_...')
#12
/Users/JG/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67):
drush_dispatch(Array)
#13
/Users/JG/.composer/vendor/drush/drush/includes/preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#14 /Users/JG/.composer/vendor/drush/drush/drush.php(12):
drush_main()
#15 {main}.
TypeError: Argument 2 passed to Drupal\migrate\Row::__construct() must be of the type array, null given, called in /Applications/MAMP/htdocs/CP8/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php on line 357 in /Applications/MAMP/htdocs/CP8/core/modules/migrate/src/Row.php on line 101 #0 /Applications/MAMP/htdocs/CP8/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php(357): Drupal\migrate\Row->__construct(Array, NULL)
#1 /Applications/MAMP/htdocs/CP8/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php(330): Drupal\migrate\Plugin\migrate\source\SourcePluginBase->next()
#2 [internal function]: Drupal\migrate\Plugin\migrate\source\SourcePluginBase->rewind()
#3 /Applications/MAMP/htdocs/CP8/core/modules/migrate/src/MigrateExecutable.php(188): FilterIterator->rewind()
#4 /Users/JG/.composer/vendor/drush/drush/includes/drush.inc(720): Drupal\migrate\MigrateExecutable->import()
#5 /Users/JG/.composer/vendor/drush/drush/includes/drush.inc(711): drush_call_user_func_array(Array, Array)
#6 /Applications/MAMP/htdocs/CP8/modules/migrate_tools/migrate_tools.drush.inc(317): drush_op(Array)
#7 [internal function]: _drush_migrate_tools_execute_migration(Object(Drupal\migrate\Plugin\Migration), 'clinical_trial_...', Array)
#8 /Applications/MAMP/htdocs/CP8/modules/migrate_tools/migrate_tools.drush.inc(272): array_walk(Array, '_drush_migrate_...', Array)
#9 /Users/JG/.composer/vendor/drush/drush/includes/command.inc(422): drush_migrate_tools_migrate_import('clinical_trial_...')
#10 /Users/JG/.composer/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#11 /Users/JG/.composer/vendor/drush/drush/includes/command.inc(199): drush_command('clinical_trial_...')
#12 /Users/JG/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#13 /Users/JG/.composer/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#14 /Users/JG/.composer/vendor/drush/drush/drush.php(12): drush_main()
#15 {main}
TypeError: Argument 2 passed to Drupal\migrate\Row::__construct() must be of the type array, null given, called in /Applications/MAMP/htdocs/CP8/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php on line 357 in Drupal\migrate\Row->__construct() (line 101 of /Applications/MAMP/htdocs/CP8/core/modules/migrate/src/Row.php).
Drush command terminated abnormally due to an unrecoverable error.
Any ideas about what I am doing wrong?
Comments
Comment #2
kalanhIt might be the path to your .xml file. I have more success when I enter a full relative path.