-
Notifications
You must be signed in to change notification settings - Fork 1
/
terms.inc
64 lines (52 loc) · 2.11 KB
/
terms.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* @file
* Implementation of migration from Commonspot's Figleaf FLEET taxonomy to a
* Drupal taxonomy
*/
class NistTermMigration extends NistMigration {
public function __construct($arguments) {
parent::__construct($arguments);
$this->description =
t('Migrate terms currently stored in FLEET database to Drupal\'s built in
taxonomy terms.');
$fields = array(
'termid' => 'Commonspot ID of the term',
'parent_id' => 'Parent term ID',
'termname' => 'Term name',
'parentname' => 'Parent term in plain english'
);
// URL of the JSON feed from Commonspot
$json_file = "";
$this->source = new MigrateSourceList(new TermListJSON($json_file),
new TermItemJSON($json_file, array()), $fields);
// Set up our destination - terms in the migrate_example_beer_styles
// vocabulary (note that we pass the machine name of the vocabulary).
$this->destination = new MigrateDestinationTerm('nist_topics');
// Create a map object for tracking the relationships between source rows
// and their resulting Drupal objects. We will use the MigrateSQLMap class,
// which uses database tables for tracking. Pass the machine name (BeerTerm)
// of this migration to use in generating map and message table names.
// And, pass schema definitions for the primary keys of the source and
// destination - we need to be explicit for our source, but the destination
// class knows its schema already.
$this->map = new MigrateSQLMap($this->machineName,
array(
'termid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Term ID',
)
),
MigrateDestinationTerm::getKeySchema()
);
$this->addFieldMapping('name', 'termname');
$this->addFieldMapping('parent_name', 'parentname');
// Unmapped destination fields
$this->addUnmigratedDestinations(array('parent', 'format', 'weight',
'description', 'path'));
// Unmapped destination fields
$this->addUnmigratedSources(array('parent_id'));
}
}