I try to use the zf2 db validator to check if a record does not exist.
I set the follow code in my controller:
$validator = new NoRecordExists(
array(
'table' => 'topics',
'field' => 'topic',
)
);
after this configuration I try to validate but I got ‘an error occurred’, can’t find any other error output who can tell me more about this error.
var_dump($validator->isValid('test'));
If someone can give me some tips, would be great 🙂
thx
Have you set the DB Adapter?
You can pass it in the contructor or called setAdapter();
You could set this up in your service config to automatically inject the adapter for you.