description = t('Migrate Document Sonore Class'); parent::__construct(); $this->fields += array( 'ID' => t('id'), 'title' => t('title'), 'synopsis_description' => t('SYNOPSIS_DESCRIPTION'), 'duree' => t('duree'), 'proprietaire' => t('proprietaire'), 'realisateur' => t('realisateur'), 'date_realisation' => t('date_realisation'), 'production' => t('production'), 'notes' => t('notes'), ); // 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() ); $item_ID_xpath = '@ID'; // relative to item_xpath and gets assembled // into full path /producers/producer/sourceid $items_class = new MigrateItemsXML($this->items_url, $this->item_xpath, $item_ID_xpath); // $this->source = new MigrateSourceMultiItems($items_class, $this->fields); $this->addFieldMapping('language')->defaultValue('fr'); $this->addFieldMapping('is_new')->defaultValue(TRUE); // $this->addFieldMapping('created', 'date_creation'); // $this->addFieldMapping('changed', 'date_modif'); $this->addFieldMapping('status')->defaultValue(1); $this->addFieldMapping('promote')->defaultValue(0); $this->addFieldMapping('sticky')->defaultValue(0); $this->addFieldMapping('title', 'title'); $this->addFieldMapping('field_duree', 'duree'); $this->addFieldMapping('field_synopsis_description', 'synopsis_description') ->xpath('@SYNOPSIS_DESCRIPTION'); $this->addFieldMapping('field_synopsis_description:format')->defaultValue('filtred_html'); $this->addFieldMapping('field_proprietaire', 'proprietaire') ->xpath('@ID_PROPRIETAIRE_OBJET'); $this->addFieldMapping('field_realisateur', 'realisateur') ->xpath('@REALISATEUR'); $this->addFieldMapping('field_date_realisation', 'date_realisation') ->xpath('@DATE_REALISATION'); $this->addFieldMapping('field_production', 'production') ->xpath('@PRODUCTION'); $this->addFieldMapping('field_notes', 'notes') ->xpath('@NOTES'); $this->addUnmigratedDestinations(array('revision_uid', 'created', 'changed', 'revision', 'log', 'tnid','comment', 'uid','path', 'pathauto', 'field_duree:format', 'field_duree:language', 'field_synopsis_description:language', 'field_proprietaire:language', 'field_proprietaire:format', 'field_realisateur:language', 'field_realisateur:format', 'field_date_realisation:language', 'field_date_realisation:format', 'field_production:language', 'field_production:format', 'field_notes:language', 'field_notes:format', 'field_performances' )); } public function prepareRow($row){ // dsm($row , '--- $row ---'); $xml = $row->xml; $title = $this->getAttribute($xml, 'TITRE'); if(strlen($title) > 255) $title = substr($title, 0, 250) . '...'; $row->title = $title; $row->duree = $this->getAttribute($xml, 'DUREE') .' '. $this->getAttribute($xml, 'UNITE_DUREE'); } public function prepare($node, stdClass $row) { $node->name = 'migration'; $node->workflow = 2; } }