We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

An error occurred when model validation

use Phalcon\Mvc\Model\Validator\StringLength as StringLengthValidator;

class Subscriptors extends Phalcon\Mvc\Model
{

public function validation()
{
    $this->validate(new StringLengthValidator(array(
            'field' => 'name_last',
            'max' => 10,
            'min' => 2,
            'messageMaximum' => 'We don\'t like really long names',
            'messageMinimum' => 'We want more than just their initials'
    )));
    if ($this->validationHasFailed() == true) {
            return false;
    }
}
}

This code does not run properly. 'messageMaximum' 'messageMinimum' can not show their own definitions.

The following data is displayed 。 It is not my definitions.

array (size=1)
  0 => 
    object(Phalcon\Mvc\Model\Message)[57]
      protected '_type' => string 'TooLong' (length=7)
      protected '_message' => string 'Value of field 'name' exceeds the maximum 10 characters' (length=55)
      protected '_field' => string 'name' (length=4)
      protected '_model' => null

Your error is on field name while you set the validator on the name_last field, is this a copy/paste problem?