public static function load($options = [], $handler = null) { $bag = new \Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag(); if (isset($handler['settings']['interface'])) { switch ($handler['settings']['interface']) { case 'pdo': $storage = new NativeSessionStorage($options, new PdoSessionHandler($handler['db'], $handler['settings'])); break; default: $storage = new NativeSessionStorage($options); break; } } else { $storage = new NativeSessionStorage($options); } $Session = new Session($storage, $bag); $Session->start(); return $Session; }
<?php /* Session handling, using symfony component */ $this['session'] = $this->share(function ($c) { $settings = $c->setting('factory')['session']; if (isset($settings['options'])) { $options = $settings['options']; } else { $options = []; } if (isset($settings['handler'])) { $handler = []; $handler['settings'] = $settings['handler']; if (isset($settings['handler']['db_handler'])) { $handler['db'] = $c['db']->getPdoHandle($settings['handler']['db_handler']); } } else { $handler = null; } return \Cangit\Beatrix\Session::load($options, $handler); });