I have a Client ID, and a Unique Client hash. When I register these data, it works fine. Just to be clear, I do not generate the hash.
The code I use to validate if that unique hash already exists:
protected function _getValidator($field)
{
return array(
'Db_NoRecordExists',
true,
array(
'table' => 'anunciantes',
'field' => $field,
'messages' => array(
'recordFound' => ucfirst($field) . ' "%value%" is registered'
)
)
);
}
But when I have to edit that Client, I want to validate if that hash already exists, and if that hash belongs to that Client.
How I do it? I already tried to get the value of the id by using 'exclude' option of db validator and passing $this->getValue('id')
, but that call returns null
.