You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we have a problem with a change made in that pull request (#26158) that was published under laravel 5.7.10.
The scopes are not taken into account anymore, and it cause unexpected problems,
we are handling the soft delete of pivot elements ourselves (something like ModelClass::deleted(closure)) and we are calling delete() function on the pivot instance,
and it's not working anymore, the entries are really deleted in the table and not soft deleted.
it's because of the replacement of newQuery() by newModelQuery() in AsPivot, which ignore the scopes.
Steps To Reproduce:
1 \ Check that pivot class implement SoftDelete
2 \ Check that pivot relation has a using() call with the correct pivot class
3 \ Get a pivot instance, like $object->relation()->first()->pivot
4 \ Call the delete function $pivot->delete()
5 \ Check the database, rows are gone
6 \ Replace newModelQuery by newQuery in AsPivot
7 \ Repeat step 3 and 4, and check that rows are now correctly soft-deleted
The only fix for us seems to be using deleted_at property directly, without calling ->delete(), but it's more like a hack than a real solution.
Thanks.
The text was updated successfully, but these errors were encountered:
lk77
changed the title
AsPivot - SoftDelete not working anymore (#26158)
[5.7.10] AsPivot - SoftDelete not working anymore (#26158)
Jan 22, 2019
Description:
Hello,
we have a problem with a change made in that pull request (#26158) that was published under laravel 5.7.10.
The scopes are not taken into account anymore, and it cause unexpected problems,
we are handling the soft delete of pivot elements ourselves (something like ModelClass::deleted(closure)) and we are calling delete() function on the pivot instance,
and it's not working anymore, the entries are really deleted in the table and not soft deleted.
it's because of the replacement of newQuery() by newModelQuery() in AsPivot, which ignore the scopes.
Steps To Reproduce:
1 \ Check that pivot class implement SoftDelete
2 \ Check that pivot relation has a using() call with the correct pivot class
3 \ Get a pivot instance, like $object->relation()->first()->pivot
4 \ Call the delete function $pivot->delete()
5 \ Check the database, rows are gone
6 \ Replace newModelQuery by newQuery in AsPivot
7 \ Repeat step 3 and 4, and check that rows are now correctly soft-deleted
The only fix for us seems to be using deleted_at property directly, without calling ->delete(), but it's more like a hack than a real solution.
Thanks.
The text was updated successfully, but these errors were encountered: