Skip to content

Instantly share code, notes, and snippets.

@lsmith77
Created June 10, 2015 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsmith77/f1ab3fe12fb0813ba4f7 to your computer and use it in GitHub Desktop.
Save lsmith77/f1ab3fe12fb0813ba4f7 to your computer and use it in GitHub Desktop.
this compiler pass fails with "Unable to dump a service container if a parameter is an object or a resource."
<?php
namespace Liip\TranslationBundle\DependencyInjection\Compiler;
use Doctrine\ODM\PHPCR\Mapping\Annotations\Reference;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Compiler pass to dynamically set the service for isGrant checks (can be removed when requiring Symfony 2.6+
*
* This file is part of the LiipTranslationBundle. For more information concerning
* the bundle, see the README.md file at the project root.
*
* @package Liip\TranslationBundle\DependencyInjection
* @version 0.2.0
*
* @license http://opensource.org/licenses/MIT MIT License
* @author Lukas Kahwe Smith <smith@pooteeweet.org>
* @copyright Copyright (c) 2015, Liip, http://www.liip.ch
*/
class SecurityPass implements CompilerPassInterface
{
/**
* {@inheritDoc}
*/
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('liip.translation.security');
if ($container->has('security.authorization_checker')) {
$definition->addArgument(new Reference('security.authorization_checker'));
} else {
$definition->addArgument(new Reference('security.context'));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment