From 53364a23a0e1481c74fb77524f5786485bd55b96 Mon Sep 17 00:00:00 2001 From: Piers Warmers Date: Tue, 2 Dec 2014 09:47:38 +1100 Subject: [PATCH] Updated examples to reflect changes in Symfony 2.6, and the depracated Symfony\Component\Security\Core\SecurityContext class - specifically: symfony/symfony#11690 --- cookbook/profiler/matchers.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cookbook/profiler/matchers.rst b/cookbook/profiler/matchers.rst index b23af0d21f0..c1494b38c1a 100644 --- a/cookbook/profiler/matchers.rst +++ b/cookbook/profiler/matchers.rst @@ -70,22 +70,22 @@ something like:: // src/Acme/DemoBundle/Profiler/SuperAdminMatcher.php namespace Acme\DemoBundle\Profiler; - use Symfony\Component\Security\Core\SecurityContext; + use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestMatcherInterface; class SuperAdminMatcher implements RequestMatcherInterface { - protected $securityContext; + protected $authorizationChecker; - public function __construct(SecurityContext $securityContext) + public function __construct(AuthorizationChecker $authorizationChecker) { - $this->securityContext = $securityContext; + $this->authorizationChecker = $authorizationChecker; } public function matches(Request $request) { - return $this->securityContext->isGranted('ROLE_SUPER_ADMIN'); + return $this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN'); } } @@ -101,7 +101,7 @@ Then, you need to configure the service: services: acme_demo.profiler.matcher.super_admin: class: "%acme_demo.profiler.matcher.super_admin.class%" - arguments: ["@security.context"] + arguments: ["@security.authorization_checker"] .. code-block:: xml @@ -114,7 +114,7 @@ Then, you need to configure the service: - + .. code-block:: php @@ -129,7 +129,7 @@ Then, you need to configure the service: $container->setDefinition('acme_demo.profiler.matcher.super_admin', new Definition( '%acme_demo.profiler.matcher.super_admin.class%', - array(new Reference('security.context')) + array(new Reference('security.authorization_checker')) ); Now the service is registered, the only thing left to do is configure the pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy