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.

What's the internal difference between Phalcon\Validation and Phalcon\Mvc\Model\Validator?

I get that Phalcon\Validation is used for forms and Phalcon\Mvc\Model\Validator for models, but what's the main reason for the separation? I was looking at the source code and it seems to have some sort of duplication of functionality.

I guess it would be too complex to keep a common interface? But what if I want to create a custom validator and use it both in the Model or any sort of input?


My understanding is that Model\Validator is restricted for use within a model and that model's CRUD methods and Phalcon\Validation can be invoked independently (outside of a model) and used at anytime.


exactly as @Zach said, but with Phalcon 2.1 "Phalcon\Mvc\Model\Validator" is deprecated and replaced with "Phalcon\Validation"; so is one validator for all


Thanks for pointing me to the right direction! An kudos to Phalcon!