security.expression_language_provider , symfonys, , , ExpressionVoter.
@Security-Annotation FrameworkBundle , , .
@Security-Annotation, , :
<?php
namespace ApiBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Reference;
class AddExpressionLanguageProvidersPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if ($container->has('sensio_framework_extra.security.expression_language')) {
$definition = $container->findDefinition('sensio_framework_extra.security.expression_language');
foreach ($container->findTaggedServiceIds('security.expression_language_provider') as $id => $attributes) {
$definition->addMethodCall('registerProvider', array(new Reference($id)));
}
}
}
}
, , ExpressionVoter FrameworkBundle, .