Actually I am storing on value in the container in index action then i am fetching that value in same action but i am not able to fetch that value in another action of that same controller as well as in another controller...am I missing Something?
This is my code..
IndexController
class IndexController extends AbstractActionController { public function indexAction() { $session=new Container('temp'); $session->username="bhavik"; error_log("in index Controller value=$session->username"); return new ViewModel(); } public function welcomeAction() { $session = new Container('temp'); error_log("in index controller welcome action value==".$session->username); $username = $session->username; return new ViewModel(); } }
this is the configuration in
module.php
public function initSession($config) { $sessionConfig = new SessionConfig(); $sessionConfig->setOptions($config); $sessionManager = new SessionManager($sessionConfig); $sessionManager->start(); Container::setDefaultManager($sessionManager); } public function onBootstrap(MvcEvent $e) { $eventManager = $e->getApplication()->getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener->attach($eventManager); $this->initSession(array( // 'remember_me_seconds' => 240, 'use_cookies' => true, 'cookie_lifetime' => 2592000, // 'cookie_httponly' => true, 'gc_maxlifetime' => 2592000 )); }
this is it and all common configs and use.. I am able fetch the value of $session->username in index action but not in the welcome action..
Any help will be appreciated.