phpcr-odm
phpcr-odm copied to clipboard
Reorder with rename test
This is a failing test, is it valid behavior?
i think renames are only put into phpcr on flush. so the var_dumps can be expected to return the old name.
but i fear the reordering is taking shortcuts with phpcr to decide how to order things. what the right thing is depends on the order in which the UoW is telling phpcr about the move and the orderBefore. semantically i would expect the dm to handle that case properly. so depending on the execution order it either needs to update pending reorders when a move is detected maybe?
maybe #449 could fix this, or at least will have an influence on this test. want to check on the #449 branch?
i just investigated this a bit. from the way the children collection works, it is clear what happens. we ask phpcr for the list of children, but the rename is not put into the phpcr layer before the flush. if we want this to work, we would need to build a pending move table in the unit of work where explicit moves and move by assignment are tracked, and adjust the children mapping to be aware of that. even then, if you first would load the parent and then move the child, the children collection would still not see the move. i am afraid of the complexity we run into with such things. we have to figure out what the sane use cases are and stick to those.