Ticket #1701 (closed defect: fixed)
doctrine:data-load does not load product of NestedSet data-dump without children
| Reported by: | dao | Owned by: | jwage |
|---|---|---|---|
| Priority: | major | Milestone: | 1.0.7 |
| Component: | Import/Export | Version: | 1.0.3 |
| Severity: | Keywords: | NestedSet | |
| Cc: | Has Test: | yes | |
| Status: | Pending Core Response | Has Patch: | yes |
Description
I'm using sfDoctrinePlugin with symfony 1.2RC2 under windows/PHP 5.2.4, but the error is in Doctrine Core.
I dumped a simple NestedSet? (fixture and schema attached) with:
symfony doctrine:data-dump
and then tried to reload it with:
symfony doctrine:build-all-reload
My NestedSet? data was not loaded.
I found that Doctrine_Data_Import::_loadData looks for a 'children' property on $data if its class is a Tree. If so, it loads $data through Doctrine_Data_Import::_buildNestedSetRows. If not - as in my case - it loads through Doctrine_Data_Import::_buildRows. Later on in _loadData, there's another check to see if the data is from a tree, and if NOT, it's saved through $obj->save() (286-288). Because the data IS a tree and NOT included in $nestedSets, nothing happens.
The attached patch just removes the second check for isTree() from _loadData, and everything appears to work insofar as I'm able to manipulate the tree through sfDoctrineNestedSetManager and the contents of my NestedSet? table are identical before and after the reload.
I'm not sure why my data is dumped the way that it is, instead of with the 'children' property which seems to be how nestedSets are supposed to be exported.
