Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The new 'session' service definition support on Symfony 3.4.3 or later #13

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -22,7 +22,19 @@ class ReplaceSessionDefinitionPass implements CompilerPassInterface
*/
public function process(ContainerBuilder $container)
{
$container->setDefinition('session', $container->getDefinition('phpmentors_pageflower.conversational_session'));
$conversationalSessionDefinition = $container->getDefinition('phpmentors_pageflower.conversational_session');
$sessionDefinition = $container->getDefinition('session');

/*
* As of version 3.4.39, the 'session.attribute_bag' and 'session.flash_bag' arguments have been removed from the 'session' definition.
* See https://github.com/symfony/symfony/pull/36063 for more details.
*/
if (count($sessionDefinition->getArguments()) == 1) {
$conversationalSessionDefinition->replaceArgument(1, null);
$conversationalSessionDefinition->replaceArgument(2, null);
}

$container->setDefinition('session', $conversationalSessionDefinition);
$container->removeDefinition('phpmentors_pageflower.conversational_session');
}
}