The original problem comes from the fact that the interpretation of MVI in CodeIgniter is quite horrific. This structure pretends that View is just a template, and Model is just ORM ( which, according to some words, should be classified as an anti-template ). Which is completely wrong, and forces the logic of the business logic and presentation into the controller.
But let's leave the View aside.
A model in MVC is not a class or object. A model is a layer that contains all the business logic. It actually consists of instances of many classes. The two most common groups are Domain Objects [ 1 ] [ 2 ] (this is what people usually call "models") and the object responsible for storing and retrieving information is usually DataMappers . The model layer also contains autonomous components (both your own and third-party ones) and higher-level abstractions - services.
What you have as a Validation class can be considered a stand-alone component that can be used by a Domain object to perform validation or expect that the Domain object that will be passed in for verification depends on your implementation.
In your situation, I would deal with this at the service level. Which would either provide an instance of the View class with a valid domain object, or with an object representing an error.
Some reading materials may be of interest:
And again .. what the hell do I know about all this.
tereško
source share