NoRecordExists and RecordExists does not work when exclude paramter is of cass Where
Closed this issue · 2 comments
Sebastian-Habiger commented
As in line 300 of Zend\Validator\Db\AbstractDb the Where gets overridden the field to be checked gets lost. Changing this line to
$select
->where
->addPredicate($this->exclude);
will fix the issue. But should that Where not be inverted?
froschdesign commented
I think it was only intended for two parameter types; string and array. Compare with the DocBlock:
zend-validator/src/Db/AbstractDb.php
Lines 179 to 190 in 87e743d
The problem is that the setExclude
method does not validate the value of the parameter.
Sebastian-Habiger commented
Thank you, you are right, my fault. I was sure I read somewhere in the documentation that a where is allowed.
Using a string instead of a Where is the solution.