简体   繁体   中英

Phalcon PHP: Uniqueness across columns

The Phalcon docs mention being able to du a multiple column uniqueness validation, but they don't provide an example of how. Do I just send an array as the "field" value?

Thanks!

You can validate uniqueness across multiple columns using an array containing the field names as the value of the 'field' key for the validator.

public function validation(){
    $this->validate(new Uniqueness(array(
    'field' => array('email', 'name')
    )));
}

http://forum.phalconphp.com/discussion/4205/phalcon-model-validate-uniqueness-by-two-fields

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM