Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend Db_NoRecordExists - checking against multiple columns

Zend Db_NoRecordExists docs seem to be limited to checking only one column. Is there a way to check multiple keys when validating an entry? For example, I am allowing the same email address for different cities.

here's my current validator:

$email->setValidators(array(array('emailAddress'),
                  array('Db_NoRecordExists',false,
                  array(
                    'table'=>'usercities',
                    'field'=>'email',
                  ))));

usercities table has two columns: email varchar(64) city_id tinyint

I want to be able to check for the combination of these columns. Is this possible? I assume I'll have to create a custom validator. Can it be done without resorting to a custom class?

thanks!

Oji

like image 958
user225195 Avatar asked Dec 02 '25 05:12

user225195


1 Answers

noup. u have to write custom validator. try to code App_Validate_Db_Select which will use Zend_Db_Select as input parameter

like image 183
SMka Avatar answered Dec 06 '25 16:12

SMka