1

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 Drupal 8.7.4.

When I run the migration I get the error posted below. Here is the migration YAML 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:node

Here 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?

Here is the xml source:

<?xml version="1.0" encoding="UTF-8"?>
<clinical_study rank="15424">
  <!-- This xml conforms to an XML Schema at:
    https://clinicaltrials.gov/ct2/html/images/info/public.xsd -->
  <required_header>
    <download_date>ClinicalTrials.gov processed this data on July 05, 2019</download_date>
    <link_text>Link to the current ClinicalTrials.gov record.</link_text>
    <url>https://clinicaltrials.gov/show/NCT00001239</url>
  </required_header>
  <id_info>
    <org_study_id>890119</org_study_id>
    <secondary_id>89-C-0119</secondary_id>
    <nct_id>NCT00001239</nct_id>
  </id_info>
  <brief_title>Combination Chemotherapy (FLAC) Combined With Granulocyte-Macrophage Colony Stimulating Factor in Locally Advanced and Metastatic Breast Cancer</brief_title>
  <official_title>Combination Chemotherapy (FLAC) Combined With Granulocyte-Macrophage Colony Stimulating Factor in Locally Advanced and Metastatic Breast Cancer</official_title>
  <sponsors>
    <lead_sponsor>
      <agency>National Cancer Institute (NCI)</agency>
      <agency_class>NIH</agency_class>
    </lead_sponsor>
  </sponsors>
  <source>National Institutes of Health Clinical Center (CC)</source>
  <brief_summary>
    <textblock>
      To evaluate a dose intensive chemotherapy regimen for the treatment of locally advanced and
      metastatic breast cancer using granulocyte-macrophage colony-stimulating factor (GM-CSF) to
      ameliorate chemotherapy-induced toxicity. Combination chemotherapy consists of Flurouricil,
      Leucovorin, Adriamycin, and Cytoxan (FLAC) which will be given every 21 days for 10 cycles.
      This protocol will replace the phase I study of this regimen (MB-232/88-C-0207) which found
      the MTD of this regimen to be at the first dose level. This is a phase II study to determine
      response rates of this regimen in advanced breast cancer.
    </textblock>
  </brief_summary>
  <detailed_description>
    <textblock>
      To evaluate a dose intensive chemotherapy regimen for the treatment of locally advanced and
      metastatic breast cancer using granulocyte-macrophage colony-stimulating factor (GM-CSF) to
      ameliorate chemotherapy-induced toxicity. Combination chemotherapy consists of Flurouricil,
      Leucovorin, Adriamycin, and Cytoxan (FLAC) which will be given every 21 days for 10 cycles.
      This protocol will replace the phase I study of this regimen (MB-232/88-C-0207) which found
      the MTD of this regimen to be at the first dose level. This is a phase II study to determine
      response rates of this regimen in advanced breast cancer.
    </textblock>
  </detailed_description>
  <overall_status>Completed</overall_status>
  <start_date>July 1989</start_date>
  <completion_date>January 2001</completion_date>
  <phase>Phase 2</phase>
  <study_type>Interventional</study_type>
  <has_expanded_access>No</has_expanded_access>
  <study_design_info>
    <primary_purpose>Treatment</primary_purpose>
  </study_design_info>
  <enrollment>100</enrollment>
  <condition>Breast Cancer</condition>
  <condition>Breast Neoplasms</condition>
  <intervention>
    <intervention_type>Drug</intervention_type>
    <intervention_name>FLAC with GM-CSF</intervention_name>
  </intervention>
  <eligibility>
    <criteria>
      <textblock>
        All stage III or clinical T3N0 or TxN2 patients must have a histologically documented
        diagnosis of breast carcinoma and evaluate disease in the breast or axilla.

        Patients with stage III must enter this protocol within 12 weeks of the initial diagnosis.

        Patients with Stage IV (metastatic) breast cancer must have histologically proven diagnosis
        and must have evaluate disease. Patients with bone-only disease may be considered eligible
        after discussion with Dr. Kenneth Cowan.

        For Stage III disease, there must be no history of prior cytotoxic therapy.

        Stage IV patients will be eligible if they have had prior adjuvant chemotherapy and/or
        hormonal therapy provided the regimen did not included adriamycin. Patients will also be
        eligible if they have been treated with one prior Phase I or II single chemotherapy agent
        on a Medicine branch protocol. Patients who have had prior radiation therapy may be
        eligible providing there was not extensive radiation to the cardiac area.

        There must be no history of previous malignancy except for cured non-melanoma skin cancer
        (basal cell carcinoma) and cervical cancer in situ.

        Performance status (Karnofsky scale) must be greater than 70.

        WBC count greater than 4000/mm3 and platelet count 100,000/mm3, unless there is evidence of
        bone marrow involvement with tumor.

        Liver function tests (SGOT, Alk. Phosph., and T. Bilil) should be less than 1.5 times the
        upper limits of normal, and serum creatinine should be less than 1.7 or creatinine
        clearance should be greater than 45 ml/min unless these abnormalities are due to tumor
        involvement.

        The patient must give informed consent.

        No pregnant patients may be entered on this study; all patients should be informed about
        the need for contraception.

        No history of other malignant neoplasms except for curatively treated basal cell skin
        cancer or surgically cured carcinoma of the cervix in situ.

        Patients must not be in poor medical or psychiatric risks because of nonmalignant systemic
        disease which would preclude them being subjected to any treatments in this protocol.

        Patients with a history of cardiac disease must have a normal ejection fraction by MUGA
        Scan and have no angina.

        Must not have evidence of CNS metastasis.
      </textblock>
    </criteria>
    <gender>All</gender>
    <minimum_age>N/A</minimum_age>
    <maximum_age>N/A</maximum_age>
    <healthy_volunteers>No</healthy_volunteers>
  </eligibility>
  <location>
    <facility>
      <name>National Cancer Institute (NCI)</name>
      <address>
        <city>Bethesda</city>
        <state>Maryland</state>
        <zip>20892</zip>
        <country>United States</country>
      </address>
    </facility>
  </location>
  <location_countries>
    <country>United States</country>
  </location_countries>
  <reference>
    <citation>Swain SM, Sorace RA, Bagley CS, Danforth DN Jr, Bader J, Wesley MN, Steinberg SM, Lippman ME. Neoadjuvant chemotherapy in the combined modality approach of locally advanced nonmetastatic breast cancer. Cancer Res. 1987 Jul 15;47(14):3889-94.</citation>
    <PMID>3036348</PMID>
  </reference>
  <reference>
    <citation>Antman K, Gale RP. Advanced breast cancer: high-dose chemotherapy and bone marrow autotransplants. Ann Intern Med. 1988 Apr;108(4):570-4. Review.</citation>
    <PMID>3279894</PMID>
  </reference>
  <reference>
    <citation>Clark SC, Kamen R. The human hematopoietic colony-stimulating factors. Science. 1987 Jun 5;236(4806):1229-37. Review.</citation>
    <PMID>3296190</PMID>
  </reference>
  <verification_date>April 2000</verification_date>
  <study_first_submitted>November 3, 1999</study_first_submitted>
  <study_first_submitted_qc>December 9, 2002</study_first_submitted_qc>
  <study_first_posted type="Estimate">December 10, 2002</study_first_posted>
  <last_update_submitted>March 3, 2008</last_update_submitted>
  <last_update_submitted_qc>March 3, 2008</last_update_submitted_qc>
  <last_update_posted type="Estimate">March 4, 2008</last_update_posted>
  <keyword>5-Fluorouracil</keyword>
  <keyword>Adriamycin</keyword>
  <keyword>Breast Carcinoma</keyword>
  <keyword>Leucovorin</keyword>
  <keyword>Phase II</keyword>
  <condition_browse>
    <!-- CAUTION:  The following MeSH terms are assigned with an imperfect algorithm            -->
    <mesh_term>Breast Neoplasms</mesh_term>
  </condition_browse>
  <intervention_browse>
    <!-- CAUTION:  The following MeSH terms are assigned with an imperfect algorithm            -->
    <mesh_term>Sargramostim</mesh_term>
  </intervention_browse>
  <!-- Results have not yet been posted for this study                                          -->
</clinical_study>
2
  • Follow message **Argument 2 passed to Drupal\migrate\Row::__construct() must be of the type array, null given, called in ** I can guess your problem come from xml source file. So you can provide xml file maybe some one help you.
    – Jonh
    Aug 8, 2019 at 8:10
  • Thanks, John. I added the source file.
    – Finn
    Aug 8, 2019 at 13:54

1 Answer 1

2

Any source have to ids property. So you need define ids in your file like below:

  fields:
    -
      name: title
      label: title
      selector: official_title
    -
      name: id
      label: id
      selector: id_info/org_study_id
  ids:
    id:
      type: integer

Note: after change file yml, you have to re-import and clear cache.

1
  • Adding the ids property solved the same error in my case. Thx!
    – makkus
    May 7, 2021 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.