Adjusted the compileDelete function to allow joins when deleting #5652
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It makes no sense to disallow calling delete() for queries with joins, especially when it is such a simple fix to get it working. This commit adjusts the compileDelete function so that the following will work:
App::make('A')->join('b', 'b.x', '=', 'a.x')->where('b.y', 'z')->delete();
Previously it was (counter-intuitively) stripping out the "join" from the delete call, resulting in unpredictable results - usually an exception, but on rare occasions (e.g. when using a join to restrct the result set by the presence of a value in another table) it could execute incorrect sql, causing hard to track down heisenbugs.
I've also allowed limit and offset, mainly because I could not think of any reason to exclude them.