Conditions | 3 |
Paths | 4 |
Total Lines | 43 |
Code Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | public function __construct($arguments) { |
||
11 | parent::__construct($arguments); |
||
12 | $this->description = t('Import Commerce Product FPPs.'); |
||
13 | |||
14 | // Create a map object for tracking the relationships between source rows |
||
15 | $this->map = new MigrateSQLMap($this->machineName, |
||
16 | array( |
||
17 | 'Title' => array( |
||
18 | 'type' => 'varchar', |
||
19 | 'length' => 255, |
||
20 | 'not null' => FALSE, |
||
21 | ) |
||
22 | ), |
||
23 | array( |
||
24 | 'title' => array( |
||
25 | 'type' => 'varchar', |
||
26 | 'length' => 255, |
||
27 | 'not null' => FALSE, |
||
28 | ) |
||
29 | ) |
||
30 | ); |
||
31 | |||
32 | // Create a MigrateSource object. |
||
33 | if (isset($arguments['path'])) { |
||
34 | $import_path = $arguments['path']; |
||
35 | } |
||
36 | else { |
||
37 | $import_path = drupal_get_path('module', 'df_tools_commerce_product') . '/import/df_tools_commerce.fpp.commerce_product.csv'; |
||
38 | } |
||
39 | $this->source = new MigrateSourceCSV($import_path, array(), array('header_rows' => 1)); |
||
40 | $this->destination = new MigrateDestinationFieldablePanelsPanes('commerce_product'); |
||
41 | |||
42 | $source_migration = isset($arguments['source_migration']) ? $arguments['source_migration'] : 'DemoFrameworkBaseCommerceNodes'; |
||
43 | $this->addFieldMapping('field_commerce_product_reference', 'Product')->separator(',')->sourceMigration($source_migration);; |
||
44 | |||
45 | $this->addFieldMapping('title', 'Title'); |
||
46 | $this->addFieldMapping('category', 'Category')->defaultValue('Reusable panes'); |
||
47 | |||
48 | // Add optional mapping for UUID |
||
49 | $this->addFieldMapping('uuid', 'UUID'); |
||
50 | |||
51 | $this->addFieldMapping('reusable', 'Reusable')->defaultValue(TRUE); |
||
52 | } |
||
53 | |||
55 |