I'm trying to create a hierarchical taxonomy from a perpared migration database table which looks like that:
ID | NAME | PARENT
------------------
0 | FOO |
1 | BAR |
2 | LORE | FOO
3 | IPSE | FOO
4 | DOLO | BAR
It's a pretty messy data structure, but fact is there are parent and child terms in one table.
What I did so far is migrating the parent terms first. Now my custom taxonomy looks like this:
_
|_ FOO
|_ BAR
The migration code snipped I used to achieve this works like that:
$this->addFieldMapping('name', 'PARENT');
Until now everything works as expected!
Now, in a second migration step I want to add the child terms like that to my taxonomy:
_
|_ FOO
|_ LORE
|_ IPSE
|_ BAR
|_ DOLO
What I tried is to add a hierarchical mapping to my migration:
$this->addFieldMapping('name', 'NAME');
$this->addFieldMapping('parent_name', 'PARENT')
->arguments(array('source_type' => 'name'));
But this does not work, the result is an unhierarchical list like that:
_
|_ FOO
|_ LORE
|_ IPSE
|_ BAR
|_ DOLO
Did anyone try to do something like this before? Any ideas? Thanks!