Skip to main content
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Hi, I'm trying to put an object into $_SESSION by this way :
when in other action, I want to get my seller back by this way :
the $this->seller object is incomplete, when I do a print_r($this->seller), I've got "__PHP_Incomplete_Class Object".
I think that's because session_start() is called before the model's classes definition...
Sorry for my english :)
AFAIK, this is because session doesn't put the object in correctly unless you serialize it, and then unserialize it back.
$obj = DataObject::get_one('Page');
// Set the object in session
// Get it back again
$returnObj = unserialize(Session::get('MyPage'));
ok thanks, It should be interesting that Session::set(....) and Session::get(...) automatically serialize and unserialize objects.
We tend to avoid putting objects into session. Just put $current_seller->ID in the session.
This is true. Isn't there some sort of character length maximum for session?