cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[NFR] Add "where" condition to Validator Uniqueness

Open joeyew opened this issue 13 years ago • 2 comments

Can we specify more conditions that will be added as "where" clauses to the query:

$this->validate(new Uniqueness(array(
     'field' => 'email',
     'condition'=>'status != "DELETE"'
)));

In the rule above, only rows with status not deleted would be included in the unique check.

joeyew avatar Sep 03 '13 10:09 joeyew

If the Uniqueness validator does not allow that, It is possible to define a new validator class e.g. class UniquenessAnd extends Uniqueness{ } And add and implement the extended options there.

alirezakazemi avatar Sep 04 '13 00:09 alirezakazemi

There is except option which is solving this i think in phalcon 3.

Jurigag avatar Jan 25 '17 22:01 Jurigag