description = t('Update Lieu Date Contexte (effectuation) Class'); parent::__construct(); $this->systemOfRecord = Migration::DESTINATION; $fields = array( 'ID' => t('id'), ); // The source ID here is the one retrieved from the XML listing file, and // used to identify the specific item's file $this->map = new MigrateSQLMap($this->machineName, array( 'ID' => array( 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, ) ), MigrateDestinationNode::getKeySchema() ); // This can also be an URL instead of a file path. $xml_folder = DRUPAL_ROOT . '/' . drupal_get_path('module', 'PerfMigrate') . '/xml/'; $items_url = $xml_folder . 'baseperf-ldcs.xml'; // We use the MigrateSourceMultiItems class for any source where we obtain the list // of IDs to process and the data for each item from the same file. Typically the data // for an item is not contained in a single line within the source file. Examples include // multiple items defined in a single xml file or a single json file where in both cases // the id is part of the item. $item_xpath = '/ROOT/ITEMS/LIEU_DATE_CONTEXTE'; // relative to document $item_ID_xpath = '@ID'; // relative to item_xpath and gets assembled // into full path /producers/producer/sourceid $items_class = new MigrateItemsXML($items_url, $item_xpath, $item_ID_xpath); // $this->source = new MigrateSourceMultiItems($items_class, $fields); $this->destination = new MigrateDestinationNode('effectuation'); $this->addFieldMapping('nid', 'ID') ->sourceMigration('PerfLDCNode'); } public function prepareRow($row){ } public function prepare($node, stdClass $row) { } public function complete($node, stdClass $row){ $xml = $row->xml; # personnes $this->recordGroup($node, 'field_concepteur', $xml, 'CONCEPTEUR'); $this->recordGroup($node, 'field_executant',$xml, 'EXECUTANT'); $this->recordGroup($node, 'field_organisateur', $xml, 'ORGANISATEUR'); $this->recordGroup($node, 'field_temoin', $xml, 'TEMOIN'); node_save($node); # personnes $this->updatePersonneTerms($xml); } }