Welcome Guest, Not a member yet? Register   Sign In
Extending Session
#1

[eluser]North2Alaska[/eluser]
What I need to do is change the way the session class talks to the database. I need to add a couple of other columns to be used to joins other tables.

I've been reading lots of posts about extending the session class. Before I dive in and roll my own, I just wanted to check and see if anybody had already done this. I would love it if someone had work session over enough to pull the database code and put it into another class that could be extended. It would make my life easier.
#2

[eluser]Thorpe Obazee[/eluser]
What exactly do you want to do? Can't you do it in the Model?
#3

[eluser]North2Alaska[/eluser]
I would like to leverage the session table to know who's online and I want to add some additional information about the users session to join to other tables. This additional data is session specific and can't live in the user_data column because of the join requirement.

I could create another table with the additional data and create a model to deal with it, but it seems like a good fit to just handle it in the session table.
#4

[eluser]TheFuzzy0ne[/eluser]
I'd go with another table if I were you, since you'll no doubt want an easy way to obtain the users user ID and/or username. You can't do that with the sessions table without messing around with serialized arrays.
#5

[eluser]North2Alaska[/eluser]
Yes, that is what will have to be done. Session will have to be changed to include the new columns and then store them to the database. Part of the challenge here is I'm replacing an existing sessions type table with CI and this seem like the best place to do it. Maybe it is overly aggressive to make this kind of change to session, but there has been discussion about this before, but just no resolution. I was hoping someone had already made the attempt.




Theme © iAndrew 2016 - Forum software by © MyBB