We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Filtering before validation

My models use beforeSave to sanitize and trim data. But I also use the model validation and some regex validations require that the values have no spaces.

Trim is used to remove unwanted spaces but beforeSave runs after the validation so the regex fails before trim.

How can I trim/escape/sanitize values before the validation?

Woops! I missed that. Thanks a lot.