We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Model Scopes

Hi all,

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.

  1. MVC Query will be rewritten to be more of database model object
    • Explaination:
    • 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.
  2. MVC model will serve as model view object
    • Explaination:
    • 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.
  3. MVC Model Manager will become Model View Manager
  4. Need to add an addtitional Database model manager ?

I believe these are the 4 steps needed. Experts please fill this thread!



7.1k

Has this moved forward?