I have been going thinking about model scopes, and how best to implement it in phalcon. I have an idea, its not concrete yet, but i shall work on it and provide a POC.
But here's the concept of how it will work, not entirely sure if this is the right way to implement it, but i am hoping that people with more experience would clarify it for me.
- MVC Query will be rewritten to be more of database model object
- Query will be the base class your model is based upon, and scopes will be defined here.
- Query will contain method for converting it into model view objects.
- MVC model will serve as model view object
- Fields should now be dynamic, meaning there will no longer be any fields declared, everything is dynamically set by the scope
- Relationships will still be handled here.
- MVC Model Manager will become Model View Manager
- Need to add an addtitional Database model manager ?
I believe these are the 4 steps needed. Experts please fill this thread!