/** * Registers the session component in the DI container. * * @return void */ public function register() { $this->di->setShared('session', function () { $session = new SessionAdapter(); if (!$session->isStarted()) { $session->start(); } return $session; }); }
public function onBoot() { // TODO: Implement onBoot() method. $this->getDI()->setShared('session', function () { $session = new Session(); if (!$session->isStarted()) { $session->start(); } return $session; }); }
/** * @inheritdoc */ public function connect(array $config) { $session = new SessionAdapter(); $id = di('crypt')->encrypt($config['app']['key']); $name = $config['session']['cookie']; //$session->setId($id); session_name($name); $session->setOptions(['uniqueId' => $id]); if (!$session->isStarted()) { $session->start(); } return $session; }
/** * Initializes the session * * @param array $options */ protected function initSession($options = array()) { $this->_di->set('session', function () { $session = new PhSession(); if (!$session->isStarted()) { $session->start(); } return $session; }); }
/** * * @param type $options */ protected function initSession($options = []) { $this->_di->setShared('session', function () { $session = new Session(['uniqueId' => 'api_phalcon-']); if (!$session->isStarted()) { $session->start(); } return $session; }); }