79799013

Date: 2025-10-24 17:13:38
Score: 0.5
Natty:
Report link

Apparently, I have to implement isAllowEmpty method as below to get the desired behavior:

public function isAllowEmpty(\Phalcon\Filter\Validation $validation, $field): bool
{
    $value = $validation->getValue($field);
    return $this->allowEmpty($field, $value);
}

Now this is my output:

Executing allowEmpty! // from preChecking method in Phalcon\Filter\Validation class.
Executing allowEmpty! // one from my validate method.
Field `foo` is invalid!

I found out that there is a check for isAllowEmpty method existance in Phalcon source code of Phalcon\Filter\Validation class. But isAllowEmpty method could only be found in Phalcon\Filter\Validation\Validator\File\AbstractFile and not in AbsctractValidator.

Later I will try to open the issue at Phalcon's GitHub repo.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Dvamuch