I am using zend framework 3 and want to check if the email address already exist in database, but my code is in zendframework 2. What is the replacement for Zend_Validate_Db_RecordExists of zendframework 2 in zendframework 3 ?
//Check that the email address exists in the database
$validator = new Zend_Validate_Db_RecordExists('users', 'emailaddress');
if ($validator->isValid($emailaddress)) {
// email address appears to be valid
} else {
// email address is invalid; print the reasons
foreach ($validator->getMessages() as $message) {
echo "$message
";
}
}
//Check that the email address exists in the database
$validator = new Zend_Validate_Db_RecordExists('users', 'emailaddress');
if ($validator->isValid($emailaddress)) {
// email address appears to be valid
} else {
// email address is invalid; print the reasons
foreach ($validator->getMessages() as $message) {
echo "$message
";
}
}