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

[5.5] Model::$exists to be set to false when force-deleting a model using SoftDeletes #22100

Merged
merged 2 commits into from
Nov 16, 2017

Conversation

PGBI
Copy link
Contributor

@PGBI PGBI commented Nov 16, 2017

On model force deletion, made sure that $model->exists is set to false.

@PGBI PGBI changed the title Model::$exists to be set to false when (force)deleting a model using … Model::$exists to be set to false when (force)deleting a model using SoftDeletes Nov 16, 2017
@PGBI PGBI changed the title Model::$exists to be set to false when (force)deleting a model using SoftDeletes Model::$exists to be set to false when (force)deleting a model using SoftDeletes Nov 16, 2017
@taylorotwell
Copy link
Member

Wasn't this recently changed? I feel like it keeps going back and forth.

@PGBI
Copy link
Contributor Author

PGBI commented Nov 16, 2017

Sorry, I should have declined and resubmitted.

In the initial PR, I made $this->exists = false; for both soft deletion and force deletion. But it caused this new bug:

$softDeletableModel->delete(); // model is soft deleted, exists == false
$softDeletableModel->forceDelete(); // <--- nothing happens, because delete() would abort if $exists == false

So I went back to setting $this->exists = false; on force deletion only.

@PGBI PGBI changed the title Model::$exists to be set to false when (force)deleting a model using SoftDeletes Model::$exists to be set to false when force-deleting a model using SoftDeletes Nov 16, 2017
@PGBI PGBI changed the title Model::$exists to be set to false when force-deleting a model using SoftDeletes [5.5] Model::$exists to be set to false when force-deleting a model using SoftDeletes Nov 16, 2017
@taylorotwell taylorotwell merged commit fded7b4 into laravel:5.5 Nov 16, 2017
@PGBI PGBI deleted the 5.5 branch November 17, 2017 08:57
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.

2 participants