I want to share my thoughts on the implementation of the MVC in Phalcon.
Class Phalcon\Mvc\Model represents the implementation of ActiveRecord (ORM). But the model in the MVC pattern is not necessary and not only is DAO (Data Access Object), and also contains the business logic. On the basis of these considerations I have two questions:
- Where to describe the business logic? In the child class Phalcon\Mvc\Model?
- Where describe the model did not contain the DAO (no persistent data)? For example: a model for interaction with any third-party service through the API, or some complex business logic, which is enough to store temporary data in files or memory (Phalcon\Mvc\Model tuned for relational databases), or do not require storing data in external repositories.
I imagine the implementation of the model in the MVC-frameworks like this: There is an abstract class Model, which describes the basic behavior of model in framework (DI, error handling or something like that). And in the same class DataModel (provisional name), extended the class Model, which in turn is able to work with external storage. In such a case, if you need a model with no storage, you must inherit from the class Model, and if necessary to work with data storage - DataModel.
P.S. Sorry if I'm somewhere not accurately described the specifics of Phalcon, I just started to learn it.