php - Zend Framework application design - should session variables be accessed in the Model layer -
I am working on this app which reaches the session variable in the model layer. It seems wrong, but I am ready to prove wrong. Probably not wrong, but in most places in the app, session variables are handled in the controller and passed as logic, but in other places, the value of the session is only accessed. Am I wrong that it looks like bad behavior?
Edit: One reason I do not like sessions in the model is that it seems to make it more complicated to test. It passes only as the work of the Supreme and then the records are passed back.
thx
It depends.
The way I think about it is like this:
- A model represents your data layer.
- Conclusion : If your model represents, session is stored in session,
models It is ok to access that data from within, the example is a session-based shopping cart. The objects in my car are the models of my session data.
Comments
Post a Comment