This is meant to be used with the validation API and not to be called
directly.
### Example:
{{{
$validator->add('email', [
'unique' => ['rule' => 'validateUnique', 'provider' => 'table']
])
}}}
Unique validation can be scoped to the value of another column:
{{{
$validator->add('email', [
'unique' => [
'rule' => ['validateUnique', ['scope' => 'site_id']],
'provider' => 'table'
]
]);
}}}
In the above example, the email uniqueness will be scoped to only rows having
the same site_id. Scoping will only be used if the scoping field is present in
the data to be validated.