PGBI/cakephp3-soft-delete

Validation IsUnique problem with softdeleted item

thiagojeffery opened this issue · 1 comments

Can´t use IsUnique when there is an item softdeleted, the validation ignore it and the DB return "Error: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry".

I would suggest to not use soft delete on tables where the primary key is not generated.
However, you could always check before inserting if there are soft deleted records with the same primary key.

As for the validation, it should not ignore soft deleted records, how would you guarantee primary key uniqueness otherwise?