Skip to content

Commit

Permalink
Fix dependency on a non-existent service "security.context"
Browse files Browse the repository at this point in the history
The security part is optional in the role provider class, which is why `security.token_storage` is also defined with `on-invalid=ignore`.
As we have security disabled in dev env, neither security.token_storage nor security.context exists, but it still tries to replace the dependency and loses on-invalid=ignore. Then it was complaining, that the service is missing.
  • Loading branch information
Tobion committed Dec 9, 2015
1 parent dad3372 commit 15cc7bb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions DependencyInjection/Compiler/SecurityContextPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class SecurityContextPass implements CompilerPassInterface
{
const ROLE_PROVIDER_SERVICE = 'fos_http_cache.user_context.role_provider';

/**
* {@inheritdoc}
*/
Expand All @@ -31,8 +31,8 @@ public function process(ContainerBuilder $container)
if (!$container->has(self::ROLE_PROVIDER_SERVICE)) {
return;
}
if (!$container->has('security.token_storage')) {

if (!$container->has('security.token_storage') && $container->has('security.context')) {
$definition = $container->getDefinition(self::ROLE_PROVIDER_SERVICE);
$definition->replaceArgument(0, new Reference('security.context'));
}
Expand Down

0 comments on commit 15cc7bb

Please sign in to comment.