I'm working for a company that has chosen to use the db for session handling in magento. Specifically, in /app/etc/local.xml there is this entry:
I understand that the data is being saved in the table
core_session. However, I'm not familiar with how to read from and write to the session object.
session_start() it's easy, I just write
$status= $_SESSION['status']; //read
What is the equivalent method when magento is using
db as a session storage method? I assume it's a class method. Thanks.
Best How To :
Each module in Magento can have its own session object for saving namespaced values to/from the session. For example, to set the variable
foo_bar in the "core" session namespace, all you need to do is call
To do the same thing in the "customer" session namespace,
You'd then fetch these values with
The basic idea is Magento provides you with these session objects so you don't need to worry about starting/stopping the session, or managing collisions in
$_SESSION. Behind the scenes Magento's still using
session_start -- but its handling those details for you so you can use a session model/singleton just like you'd use any model in Magento.
You also might find this answer useful.