ZF2-564: NoRecordExists and RecordExists 'exclude' field string



If you provide a string SQL query to a NoRecordExists or to a RecordExists validator, this will ignore the given value.

For example this validator just execute the query with "isConfirmed = 1 OR registrationDate >= '$expirationDate'" WHERE clausole and return true if the result give 1 or more rows.

$validator = new NoRecordExists(array( 'adapter' => $this->getAdapter(), 'table' => 'users', 'field' => 'username', 'exclude' => "isConfirmed = 1 OR registrationDate >= '$expirationDate'" ));

The aspected action is that validator execute the query with that string WHERE clausole and then search in the result to check if there are some record that match against the given value for the username field.



because 'exclude' - is expression, and need write like: 'exclude' => "(isConfirmed = 1 OR registrationDate >= '$expirationDate')"

because without '()' result SQL: WHERE username = :value AND isConfirmed = 1 OR registrationDate >= '$expirationDate'

Thank you very much.

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: