Closed tomasfejfar closed 8 years ago
What is the purpose of this PR? Could you give me more information?
The ZF1 adapter implementation did not work correctly when using custom db select that contained "wheres". I had a case for that when I added MPTT functionality to existing pages table and I needed the class to work only on rows with show_in_menu == 1
. I set the select - quite alike to how I do it in the test here - and it completly broke the MPTT, because it used WHERE show_in_menu = 1
for selects, but not for updates. This PR fixes the issue by pulling the "WHERE" data from the select and using it appropriately for UPDATE and DELETE statements.
In the first commit it adds one column (irrelevant to MPTT) to the test data to allow testing of other adapters later. The row should be ignored by default (which it is - that's why tests still work for other adapters). And I use it for ZF1 adapter test
Current stable version v.1.5.0 support only one tree per table. The purpose of method "setDefaultDbSelect" is for use case where you need to join db table. That mean it does not work correctly with "WHERE".
It does in this PR :) Although I do understand now what was the original case.
Hi @tomasfejfar . What are you think about CakePHP multi trees implementation? I think it is flexible implementation.
Scope support implemented(develop branch). Will be released in next stable minor version.
I added test as well, which only works with ZF1 adapter. I don't use the other adapters so I don't know how to test/implement it properly. Tests still pass for all adapters.
I understand that master moved in the meantime. There is a lot of conflicts and this may not at all be mergeable, but I still opened this PR in case you wanted to use some parts of it.