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

Issue Type: Bug Created: 2012-09-16T16:05:48.000+0000 Last Updated: 2012-10-08T20:12:25.000+0000 Status: Closed Fix version(s): Reporter: Egidio Caprino (aegidius) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\Validator

  • validator

Related issues: Attachments:



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.



Posted by Andrej Baranov (andrejandb) on 2012-09-17T21:45:02.000+0000

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'

Posted by Egidio Caprino (aegidius) on 2012-09-18T06:13:12.000+0000

Thank you very much.

Posted by Ralph Schindler (ralph) on 2012-10-08T20:12:25.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.