| @@ 62-82 (lines=21) @@ | ||
| 59 | ||
| 60 | class DFSMEDEditorialComments extends ImportBaseComments { |
|
| 61 | ||
| 62 | public function __construct($arguments) { |
|
| 63 | parent::__construct($arguments); |
|
| 64 | $this->description = t('Import comments.'); |
|
| 65 | // Create a map object for tracking the relationships between source rows |
|
| 66 | $this->map = new MigrateSQLMap($this->machineName, |
|
| 67 | array( |
|
| 68 | 'subject' => array( |
|
| 69 | 'type' => 'varchar', |
|
| 70 | 'length' => 255, |
|
| 71 | 'not null' => TRUE, |
|
| 72 | ), |
|
| 73 | ), |
|
| 74 | MigrateDestinationComment::getKeySchema() |
|
| 75 | ); |
|
| 76 | $import_path = drupal_get_path('module', 'dfs_med') . '/import/'; |
|
| 77 | $this->source = new MigrateSourceCSV($import_path . 'dfs_med.comments.article.csv', $this->csvcolumns(), array('header_rows' => 1)); |
|
| 78 | $this->destination = new MigrateDestinationComment('comment_node_article'); |
|
| 79 | $this->addFieldMapping('nid', 'node')->sourceMigration('DFSMEDEditorialNodes'); |
|
| 80 | $this->addFieldMapping('uid', 'author')->sourceMigration('DFSMEDUsers'); |
|
| 81 | $this->addFieldMapping('created', 'created'); |
|
| 82 | } |
|
| 83 | ||
| 84 | function csvcolumns() { |
|
| 85 | $columns[0] = array('subject', 'Subject'); |
|
| @@ 10-38 (lines=29) @@ | ||
| 7 | ||
| 8 | class DFSWEMTweetNodes extends DemoFrameworkBaseNodesUUID { |
|
| 9 | ||
| 10 | public function __construct($arguments) { |
|
| 11 | parent::__construct($arguments); |
|
| 12 | $this->description = t('Import nodes.'); |
|
| 13 | ||
| 14 | // Create a map object for tracking the relationships between source rows |
|
| 15 | $this->map = new MigrateSQLMap($this->machineName, |
|
| 16 | array( |
|
| 17 | 'tweet_id' => array( |
|
| 18 | 'type' => 'varchar', |
|
| 19 | 'length' => 255, |
|
| 20 | 'not null' => TRUE, |
|
| 21 | ), |
|
| 22 | ), |
|
| 23 | MigrateDestinationNode::getKeySchema() |
|
| 24 | ); |
|
| 25 | ||
| 26 | $import_path = drupal_get_path('module', 'dfs_wem') . '/import/'; |
|
| 27 | ||
| 28 | // Create a MigrateSource object. |
|
| 29 | $this->source = new MigrateSourceCSV($import_path . 'dfs_wem.nodes.wem_tweets.csv', $this->csvcolumns(), array('header_rows' => 1)); |
|
| 30 | $this->destination = new MigrateDestinationNode('wem_tweet'); |
|
| 31 | ||
| 32 | // Tweet Fields |
|
| 33 | $this->addFieldMapping('title', 'tweet_id'); |
|
| 34 | $this->addFieldMapping('body', 'tweet'); |
|
| 35 | $this->addFieldMapping('field_wem_tweet_id', 'tweet_id'); |
|
| 36 | $this->addFieldMapping('field_wem_tweet_from', 'tweet_from'); |
|
| 37 | ||
| 38 | } |
|
| 39 | ||
| 40 | function csvcolumns() { |
|
| 41 | $columns[0] = array('tweet', 'Tweet'); |
|
| @@ 10-38 (lines=29) @@ | ||
| 7 | ||
| 8 | class DFSWEMProducts extends DemoFrameworkBaseProducts { |
|
| 9 | ||
| 10 | public function __construct($arguments) { |
|
| 11 | parent::__construct($arguments); |
|
| 12 | $this->description = t('Import DFS WEM products.'); |
|
| 13 | ||
| 14 | // Create a map object for tracking the relationships between source rows |
|
| 15 | $this->map = new MigrateSQLMap($this->machineName, |
|
| 16 | array( |
|
| 17 | 'sku' => array( |
|
| 18 | 'type' => 'varchar', |
|
| 19 | 'length' => 32, |
|
| 20 | 'not null' => TRUE, |
|
| 21 | ), |
|
| 22 | ), |
|
| 23 | MigrateDestinationEntityAPI::getKeySchema('commerce_product', 'wem_product') |
|
| 24 | ); |
|
| 25 | ||
| 26 | $this->destination = new MigrateDestinationEntityAPI('commerce_product', 'wem_product'); |
|
| 27 | ||
| 28 | // Define a default import path. |
|
| 29 | $import_path = drupal_get_path('module', 'dfs_wem') . '/import/'; |
|
| 30 | ||
| 31 | // Create a MigrateSource object. |
|
| 32 | $this->source = new MigrateSourceCSV($import_path . 'dfs_wem.products.csv', $this->csvcolumns(), array('header_rows' => 1)); |
|
| 33 | ||
| 34 | $this->addFieldMapping('field_images:source_dir')->defaultValue($import_path . 'images'); |
|
| 35 | ||
| 36 | $this->addFieldMapping('field_wem_product_interests', 'interests'); |
|
| 37 | ||
| 38 | } |
|
| 39 | ||
| 40 | function csvcolumns() { |
|
| 41 | $columns[0] = array('title', 'Title'); |
|