My understanding of MVC-type architectures over the last few weeks/months has advanced (I'd say) considerably, and I owe most of my thanks to fellow SO enthusiasts; so, thank you!
I'm still challenged by something though, the Model. So far I've sorted out and created;
- A simple
Requestobject, that consolidates request data (GET/POST/etc. params, HTTP headers, etc.) - A simple
Responseobject, that collects response data (HTML, JSON, HTTP headers, etc.) - A fancy
Routerthat resolves URIs against a regex-powered routing table, validates them based onControllerfile/class existence/inheritance, and updates theRequestobject with any supplementary parameters. - A simple
Dispatcherobject that sets up the working environment, creates and initializes the necessaryController, and sends it aRequestandResponseobject to work with.
Now the Model.
I understand that in many (some) circumstances the Model is merely representational of it's associated entity, the table, with CRUD methods (addUser(), deleteUser(), etc.) In others there are further levels of abstraction, preventing controllers from accessing finer-grain CRUD functionality, consolidating methods (replaceUser() - deletes, adds, then returns user data)
I'm wondering what my best course of action is; for a few specific reasons.
I've created a Gateway class that acts as a proxy to an intended Model, performing ACL checks (using the Acl object, a special case "Model") using the Request and desired method and arguments as parameters for the check. The Controller is responsible for determining the outcome of a failed ACL