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
I have a model with two objects where one of them has a composite relation with the other. Both objects uses SoftDelete, and the parent cascades the SoftDelete to dependant objects that act as Sortable.
The problem arrise when you delete one element of the parent object. I tryed adding the deleted_at field to the uniqueBy. But, as all the related objects have the same deleted_at value, when the postDelete tries to reorder all the records, it throws a constraint violation.
The text was updated successfully, but these errors were encountered:
I just had the same issue, so I took a look at plugins/csDoctrineActAsSortablePlugin/lib/listener/Sortable.php, it seems the postDelete listener uses a special trick, depending on the database driver you use, to update positions on object deletion.
Fix that made the whole thing work properly for me
Look for the condition
if $this->canUpdateWithOrderBy($conn)...
Just edit the statement and replace the whole if/else block by the content of the else statement, so the postDelete behaves the same, no matter what driver you use :
I have a model with two objects where one of them has a composite relation with the other. Both objects uses
SoftDelete
, and the parent cascades theSoftDelete
to dependant objects that act asSortable
.The problem arrise when you delete one element of the parent object. I tryed adding the
deleted_at
field to theuniqueBy
. But, as all the related objects have the samedeleted_at
value, when the postDelete tries to reorder all the records, it throws a constraint violation.The text was updated successfully, but these errors were encountered: