Mr Mikkél
Mr Mikkél

Reputation: 2643

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!

Upvotes: 1

Views: 861

Answers (1)

CriticalSpeak
CriticalSpeak

Reputation: 93

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

Upvotes: 2

Related Questions