Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusted the compileDelete function to allow joins when deleting #5652

Closed
wants to merge 1 commit into from

Conversation

benubird
Copy link

@benubird benubird commented Sep 4, 2014

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.

@taylorotwell
Copy link
Member

Tests are failing.

@taylorotwell
Copy link
Member

This should really be sent to 4.2 branch. Please send it there if you don't mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants