Skip to content

Commit

Permalink
Update code to use the same config key defined in section Initializin…
Browse files Browse the repository at this point in the history
…g the Session Manager

Signed-off-by: dapphp <[email protected]>
  • Loading branch information
dapphp committed Nov 7, 2021
1 parent fc538bb commit 912490c
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions docs/book/manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ class Module
$container->httpUserAgent = $request->getServer()->get('HTTP_USER_AGENT');

$config = $serviceManager->get('Config');
if (! isset($config['session'])) {
if (! isset($config['session_manager'])) {
return;
}

$sessionConfig = $config['session'];
$sessionConfig = $config['session_manager'];

if (! isset($sessionConfig['validators'])) {
return;
Expand Down Expand Up @@ -123,23 +123,18 @@ class Module
'factories' => [
SessionManager::class => function ($container) {
$config = $container->get('config');
if (! isset($config['session'])) {
if (! isset($config['session_manager'])) {
$sessionManager = new SessionManager();
Container::setDefaultManager($sessionManager);
return $sessionManager;
}

$session = $config['session'];
$session = $config['session_manager'];

$sessionConfig = null;
if (isset($session['config'])) {
$class = isset($session['config']['class'])
? $session['config']['class']
: SessionConfig::class;

$options = isset($session['config']['options'])
? $session['config']['options']
: [];
$class = $session['config']['class'] ?? SessionConfig::class;
$options = $session['config']['options'] ?? [];

$sessionConfig = new $class();
$sessionConfig->setOptions($options);
Expand Down

0 comments on commit 912490c

Please sign in to comment.