Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Uniqness concatenate two cloumns or (mixed index)

Hello

how to use uniqness Validator for mixed columns,

like

concatenate name(attr) and family(attr) together and etc...

    $validator = new Validation();
    $validator->add(
        'name-family-...',
        new Uniqueness([
            "message" => "Error"
        ])
    );
    return $this->validate($validator);


25.3k
Accepted
answer
edited Nov '16

Since Phalcon v3.0.0 you can use combination of fields as follows:

$validator = new Validation();

$validator->add(
    ['name', 'family'],
    new Uniqueness(
        'message' => 'Error',
    )
);

return $this->validate($validator);
edited Nov '16

Since Phalcon v3.0.0 you can use combination of fields as follows: .....

Thank You , Phalcon is the best.