Setting a session in the model or controller |
[eluser]randomdriver[/eluser]
Hello, I have a programmer helping me build a project. I noticed he put the session setting in the model. I.e. the model connects to the db, checks to see if there is a user match, if there is it sets the session: $this->session->set_userdata($userArray); Is there a best practice? Does this save overhead because you don't have to pass info to the controller?
[eluser]danmontgomery[/eluser]
http://en.wikipedia.org/wiki/Model–view–controller Quote:The model is the domain-specific representation of the data upon which the application operates.
[eluser]randomdriver[/eluser]
So based on Wikipedia the session SHOULD be set in the model as best practice. However, I've seen several tutorials that set this in the Controller. Anyone else have an opinion? I know I am splitting hairs here but am curious to know what the best practice is. |
Welcome Guest, Not a member yet? Register Sign In |