-
Notifications
You must be signed in to change notification settings - Fork 4
Model validation: Unique rule #2
Copy link
Copy link
Open
Description
So, i've been using this plugin and I found an issue when trying to implement the isUnique rule validation from CakePHP itself. The validation rule can't find any records because the behavior filters it, as it really should, but, since the query can't find deleted records when validating, it can't assegure the unique rule for the field too.
To solve this, we can override the validation method directly from the SoftDeletableModel class:
class SoftDeletableModel extends Model
{
[...]
public function isUnique($fields, $or = true) {
// implement logic here
}
[...]
}I can make a PR if you think it's fine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels