There are some other issues like when scope column is a FK and onDelete="setnull", removing related/scope object will only clean the scope value leaving ranks untouched.
Improved sortable behavior - fixes some inconsistencies
This pull request fails (merged 07ff600 into 82372dd).
@travisbot You're right, I will have to adjust and add tests too.
But lets wait for someone to comment if this is a good way to go or shall we change something else?
Edit: Why does removeFromList() sets rank to null but there is no "AND SORTABLE_RANK IS NOT NULL" condition in any query?
Especially in non-scope tables where this could be expected(?)
This behavior needs more solid concept.
For now I'm confused.
Renamed old_scope attribute to oldScope
This pull request fails (merged 9df7198 into 82372dd).
@rozwell travisbot is... a bot :p
Your work seems ok, but I don't really know this behavior so.. let's see other comments, and try to fix the test suite.
@willdurand I know ;)
Unit tests are easy to fix (just 2 failed) and I will add a few more too if these changes are ok.
It looks fine to me, but as I said, I'm not expert on this. Maybe we should try to expose what the behavior should do, and how before to change everything. What do you think?
I took one more look at this behavior and after my modifications we actually need to talk about those 2 things only:
removeFromList() - I'd suggest to remove this method since we can just change the scope to null or if scope isn't used it seems better to add other column to manage visibility like is_visible so there is no need for adding NOT NULL condition mentioned above.
I've got in mind admin generator so this may affect my judgment since I also see how to manage null ranks.
onDelete="setnull" - removing related object will only clean the scope value leaving ranks untouched and since we sort in null scope too, shouldn't they be moved at the end of it? (makes most sense)
I think you are changing the behavior of ... this behavior :)
I mean, a null scope should not mean objects are not in a list. The "null" scope is actually a scope, like a "global" scope, or a "default" one I guess. So the removeFromList() makes sense. But I agree with the is_visible, it could a nice option.
Sorry for the delay, I tried to learn this behavior a bit more.
Merge with Propel/master
This pull request fails (merged fb30d63 into 8b02639).
Fixed typo in method names: preDelete => preUpdate
This pull request fails (merged 5b06917 into 8b02639).
Readded blank line before return (accidentally removed while resolvin…
…g merge conflicts)
This pull request fails (merged cce76e3d into 8b02639).
This pull request fails (merged 957b90a into 8b02639).
Applied fix #378 change for self::PEER
This pull request fails (merged 7e169b3 into 8b02639).
@willdurand is there any reason to have boolean use_scope parameter for scope, when you have to set scope_column anyway?
Isn't setting scope_column enough?
well, I think you can enable/disable the use of scopes easily.
This PR needs unit tests that fail if the builder is not modified and passes otherwise - this will reveal the interest of tour modification.
Merge remote-tracking branch 'upstream/master' into sortable_scope
@fzaninotto can you explain with more details?
sortable behavior: changed removeFromList() to work with new scope ap…
…proach, little bugfix in preUpdate
sortable behavior: tests for new scope approach (includes fixed typo …
This pull request passes (merged 3af6a72 into 441f969).
Little summary of changes:
When scope column is a FK and onDelete="setnull", removing related object should move all objects to null scope (maybe trigger removeFromList() ?) - is there a proper way to do so?
Seems ready to be merged.
So null is a scope then?
ok, I'm +1. Good patch.
@willdurand yes sir.
Great, merged! Thank you so much.
Can you port this PR on Propel2? :)
Sure, but after I fix onDelete="setnull" issue.