Does anybody try zf2? I can not understand new mechanism of using sessions in zf2. How can I write and read to/from the session in new zend framework?
Also I can not
Definitely yes, you should use Zend\Session\Container
Container extends of ArrayObject and instantiates with ARRAY_AS_PROPS
flag that means you can easily iterate through properties and read/write them, e.g.
use Zend\Session\Container as SessionContainer;
$this->session = new SessionContainer('post_supply');
$this->session->ex = true;
var_dump($this->session->ex);
First argument is session namespace and second — Manager. Manager
is a facade for Storage
and SaveHandler
and it's configured with ConfigInterface
in order to save your session data in DB or Memcache server.