Reputation: 10478
This question is exactly as specified as above. I have code that looks like this:
// These attributes are getting deleted for some reason
$this->session->set('userProfiles',new ArrayCollection($uniqueList));
// Get array filter and save it in session
$this->session->set('filter',$filter);
// Save session
$this->session->save();
// The code bellow effects my attributes above. I don't know why that is.
$this->session->set('center',$center);
// If I comment the line bellow then attributes 'userProfile' and 'filter' do not get deleted
$this->session->save();
I am so beyond baffled as to why $this->session->save(); after setting my center attribute is actually deleting my data. Symfony does not have anything like this documented. It might have something to do with garbage collection, but I don't really know.
Upvotes: 0
Views: 193
Reputation: 7745
Things you put in the session must be serializable. ArrayCollection
does not seem to implement the \Serializable
interface.
You can learn more about PHP session handling in the documentation:
When PHP shuts down, it will automatically take the contents of the $_SESSION superglobal, serialize it, and send it for storage using the session save handler.
Upvotes: 1