views:

352

answers:

1

Hi,

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

A: 

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

SM