Is Session a safe place to store data ? |
It is safe, but the approach is not good. Better keep only the user_id and retrieve the additional information by asking it from the models.
What you do now is introducing session dependency within your models. This limits the context where these models can be used. Imagine that in the future you would need to do something under CLI with these models - it would be impossible without heavy rework. Edit: Remove all the $this->session->something from all the models and pass them as method parameters. |
Welcome Guest, Not a member yet? Register Sign In |