I'm using symfony 3.4. I'm able to set and get session data within the same controller. But getting the same session data in other controllers throwing an exception : "Call to a member function get() on null".
Below is the code i'm using :
Controller1.php(Working)
$this->session = new Session();
$this->session->start();
/*** Set Session Data ***/
$this->session->set('userid', $dbres [0]['user_id']);
/*** Get Session Data ***/
$user_id = $this->session->get('userid');
Controller2.php(Not Working)
/*** Get Session Data ***/
$user_id = $this->session->get('userid');
Exception : "Call to a member function get() on null"