Rules from two tables

I want to apply isUnique from two table class.

$rules->add($rules->isUnique(
[‘person_id’],
‘This person Id Number already exists.’
));

The above code checks is unique for single table class in which it is defined.

is this still your Generic Custom Validation question?

Nopes.

Its another one.
And I will share the generic validation updates on Generic Custom Validaton Page node.

We assume that both tables are related then you can use something like:

$rules->add($rules->isUnique(['person_id', 'group_id']));

Refer: https://book.cakephp.org/3/en/orm/validation.html#creating-unique-field-rules

If it’s not related you have to use custom validator to do the job.

I wanted something like this
$rules->add($rules->isUnique([‘Table1.person_id’, ‘Table2.person_id’]));

Person_id is should be unique in either of the table.