Open h3christophe opened 8 years ago
Abstract Class Zend\Validator\Db\AbstractDb;
The function getSelect has a bug when you the exclude parameter contains a Zend\Db\Sql\Where parameter
if ($this->exclude !== null) { if (is_array($this->exclude)) { $select->where->notEqualTo( $this->exclude['field'], $this->exclude['value'] ); } else { -->>> $select->where($this->exclude); } }
The problem is that $select->where($this->exclude) will overwrite the entire WHERE clause defined just above
$select = new Select(); $tableIdentifier = new TableIdentifier($this->table, $this->schema); $select->from($tableIdentifier)->columns([$this->field]); $select->where->equalTo($this->field, null);
The workaround is when you pass a WHERE inside the exclude you have to repeat
equalTo($this->field, null);
The fix would be to use
if($this->exclude instanceof Where){ $select->where->addPredicate($this->exclude); } else { $select->where($this->exclude); }
Thank you
This repository has been closed and moved to laminas/laminas-validator; a new issue has been opened at https://github.com/laminas/laminas-validator/issues/41.
Abstract Class Zend\Validator\Db\AbstractDb;
The function getSelect has a bug when you the exclude parameter contains a Zend\Db\Sql\Where parameter
The problem is that $select->where($this->exclude) will overwrite the entire WHERE clause defined just above
The workaround is when you pass a WHERE inside the exclude you have to repeat
The fix would be to use
Thank you