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
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: https://github.com/zendframework/zf2/issues/2590
Have you found an issue?
See the Overview section for more details.