Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.3
-
Fix Version/s: None
-
Component/s: Import/Export
-
Labels:None
-
Environment:XP Xamp
Description
Hi
I recently encountered a problem when importing fixtures. I was ending up with invalid foreign key constraints due to the fact that the fixtures were importing in the wrong order. I tracked down the problem and figured out that the method Doctrine_Connection_UnitOfWork::buildFlushTree, while a truly impressive piece of sorting logic still some times still gets the order of the classes wrong in its end result.
I realized that all it needed though was a second shot at reordering the list – in other words it needed to exhaustively try to order the list until it found that everything was in the right order.
I put in a for loop in this method that will keep running until no order changes occurred or until a max number of attempts have been reached. The max number of attempts I added as a property of Doctrine_Connection called: maxBuildFlushTreeOrderAttempts.
This has solved my problem. I wouldn't be surprised if this was a common issue.
I will post my patch into this thread.
Hope all is well.
Will Ferrer
Here is the patch