Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 1.4: Storing an array in session with SetAttribute

I'm wondering if someone knows how to store an array into a user session?

This is the method to store a single attribute:

$this->getUser()->setAttribute('something', $something);

And the documentation says:

"User attributes can store any type of data (strings, arrays, and associative arrays)"

... but doesn't say anything more. The API documentation doesn't have a "SetAttributes" or something similarly obvious.

Thank you.

like image 993
Tom Avatar asked Dec 23 '22 03:12

Tom


1 Answers

Uh, as I'd written the question out, it became obvious:

$something = array();

$this->getUser()->setAttribute('something', $something);

Resolved.

like image 60
Tom Avatar answered Jan 31 '23 10:01

Tom