Created
September 21, 2016 09:26
-
-
Save inri13666/fcdcf58a6678d07f0c47c5f707c782c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace HomeNest\Bundle\ThemeBundle\Security\Authorization\Voter; | |
use ED\BlogBundle\Security\Authorization\Voter\ArticleVoter as EdArticleVoter; | |
class OverriddenArticleVoter extends EdArticleVoter | |
{ | |
public function supportsClass($class) | |
{ | |
try { | |
return parent::supportsClass($class); | |
} catch (\Error $e) { | |
return false; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace HomeNest\Bundle\ThemeBundle\DependencyInjection\Compiler; | |
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
class OverrideServiceCompilerPass implements CompilerPassInterface | |
{ | |
public function process(ContainerBuilder $container) | |
{ | |
if($container->hasDefinition('ed_blog.authorization_voter.article_voter')) { | |
$definition = $container->getDefinition('ed_blog.authorization_voter.article_voter'); | |
$definition->setClass('HomeNest\Bundle\ThemeBundle\Security\Authorization\Voter\OverriddenArticleVoter'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment