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.

Reges Validator Not Working

use Phalcon\Validation\Validator\Regex;

$contactNo = new Text('contactno');
$contactNo->setLabel('Vendor Contact Number');
    new Regex(array(
        'pattern' => '/^[789]\d{9}$/',
        'message' => 'The Contact Number is not valid'

What is wrong in this code?

It's giving me error as "The validators parameter must be an object"


Should be $contactNo->addValidator(new Regex(/* ... */)) or $contactNo->addValidators([new Regex(/* ... */), /* ... */])