Description of Problem:
When creating a transport package, if I have nested Categories (i.e. categories under categories), category parents are not updated during the install, even if xPDOTransport::PRESERVE_KEYS is set to `false`.
Steps to Reproduce:
Create a package which has categories as follows:
Category Id, Category Name, Parent
1 Top Level 0
2 First Child 1
3 Another Child 1
Set xPDOTransport::PRESERVE_KEYS = false when adding the categories to the vehicle.
On a sample target site, create a category and call it anything other than "Top Level".
Import the package, and your categories will show as follows (when querying the database):
Category Id, Category Name, Parent
1 Test Category 0
2 Top Level 0
3 First Child 1
4 Another Child 1
Expected Outcome:
Category Id, Category Name, Parent
1 Test Category 0
2 Top Level 0
3 First Child 2
4 Another Child 2
(i.e. categories 3 and 4 have a parent of 2, not 1).
Workaround:
Set xPDOTransport::PRESERVE_KEYS = true when adding the categories to the vehicle. This isn't a solution because the output you would see is:
Category Id, Category Name, Parent
1 Top Level 0
2 First Child 1
3 Another Child 1
So in essence, you have clobbered the existing category.
Another possible workaround is to simply not use nested categories, but that isn't my first preference as I like the tree structure.
- MODX Version: 2.5.5
- PHP Version: 5.3.8
- Database (MySQL, SQL Server, etc) Version: SQL Server 2008 R2
- Additional Server Info: This server likes long walks on the beach.
- Installed MODX Add-ons: Wayfinder
- Error Log Contents: No error generated
Thanks in advance for all comments. As well, this is hardly a burning issue for me, but I raise it all the same.