Closed (fixed)
Project:
Migrate
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Sep 2011 at 02:15 UTC
Updated:
20 Feb 2012 at 22:47 UTC
The import is not maintaining term hierarchy. Please check my code and see if this is what I am doing wrong or something in the migrate code
abstract class RTGTermMigration extends RTGMigration {
public function __construct($type, $vocabulary_name, $description) {
parent::__construct();
$this->description = $description;
$this->map = new MigrateSQLMap($this->machineName,
array(
'tid' => array('type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'alias' => 'vmt',
)
),
MigrateDestinationTerm::getKeySchema()
);
$query = Database::getConnection('default', 'source_rtg')
->select('view_migrate_terms', 'vmt')
->fields('vmt', array('tid','vid','name', 'description', 'weight','parent'))
->condition('vid', $type)
// This sort assures that parents are saved before children.
->orderBy('parent', 'ASC');
$this->source = new MigrateSourceSQL($query, array(), NULL, array('map_joinable' =>FALSE));
$this->destination = new MigrateDestinationTerm($vocabulary_name);
// Mapped fields
$this->addSimpleMappings(array('name','description','weight'));
$this->addFieldMapping('parent', 'parent')
->sourceMigration($this->getMachineName());
// $this->addFieldMapping('format')
// ->defaultValue($this->basicFormat->format);
// Unmapped source fields
// Unmapped destination fields
$this->addFieldMapping('parent_name')
->issueGroup(t('DNM'));
}
}
The error I get is attached.
Thanks
| Comment | File | Size | Author |
|---|---|---|---|
| migrate_error.png | 187.79 KB | rocket777 |
Comments
Comment #1
rocket777 commentedIs "Taxonomy term hierarchy" not working a bug? if so, has it been fixed?
Thanks
Comment #2
mikeryanThis is a dupe of #1300258: Migrating nodes with multiple terms and vocs. Keeping that one open because it has more info.
Comment #3
mikeryanMy mistake - the symptoms are similar, but the other issue is about term references, this is about term parents...
Comment #4
mikeryanThe difference between !isset() and empty() can be subtle, but sometimes important... Fixed!
Comment #6
rlmumfordI'm having the same problem with very similar code. How was this fixed?
Comment #7
mikeryanIt was fixed in a patch months ago. Term hierarchies are working fine for me - what precise problem are you seeing? Are you using 7.x-2.x-dev?
Comment #8
mikeryanComment #9
mikeryanLong fixed.