Symfony 1.4: saving an array in a session using SetAttribute

I am wondering if anyone knows how to store an array in a user session?

This is a method for storing a single attribute:

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

And the documentation says:

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

... but says nothing more. The API documentation does not have "SetAttributes" or something like that.

Thanks.

+4
source share
1 answer

As I wrote, the question became obvious:

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

Decided.

+11
source

Source: https://habr.com/ru/post/1307198/


All Articles