Closed stof closed 8 years ago
So to be clear, the only case working properly currently when association are involved is when each class is processed before its dependencies, i.e. the input array is already sorted. An unsorted input would produce a broken output (which is quite unfortunate for a sorter)
@stof can you write a test for it too?
Well, I don't understand how the ORMPurger is tested currently. It seems to be mocking the EM, but this bug will appear because of DB foreign keys.
Ah, indeed, confused this with the sorter itself. You are just using the sorter here. Wondering if this rule should be encapsulated in addNode()
?
yeah, the adder should probably check for it. Do you prefer for it to throw an exception if called a second time, or to silently keep the existing vertex ?
Would probably keep the vertex, if it's the same...
@stof, @Ocramius please have a look at https://github.com/doctrine/data-fixtures/pull/231
Is there any news on this? Would love to have this merged..
Closing as #240 was merged and it also included this fix
The node for a class could have been added in the TopologicalSorter before the class is processed itself, in case it is the target of an association in a previous class. In this case, the node should not be overwritten, as this would make it forget all previous dependencies.