Skip to content

Commit

Permalink
Symfony 3 fixed issue related to symfony/symfony#11881
Browse files Browse the repository at this point in the history
  • Loading branch information
boekkooi committed Dec 4, 2015
1 parent f825007 commit c8025bd
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 123 deletions.
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
"phpunit/phpunit": "4.6.4",
"phpunit/phpunit-mock-objects": "2.3.1",
"fabpot/php-cs-fixer": "1.6.2",
"kriswallsmith/assetic": "~1.2",

"symfony/assetic-bundle": "~2.3",
"symfony/validator": "~2.3, >=2.3.19|~3.0",
"doctrine/common": "~2.2"
"doctrine/common": "~2.2",

"matthiasnoback/symfony-dependency-injection-test": "^0.7"
},
"license": "MIT",
"authors": [
Expand Down
32 changes: 27 additions & 5 deletions src/DependencyInjection/BoekkooiTwigJackExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ public function load(array $config, ContainerBuilder $container)

$this->loadDefer($container, $loader, $config);
$this->loadConstraint($container, $loader, $config);

if ($config['exclamation']) {
$loader->load('exclamation.yml');
$container->setParameter('boekkooi.twig_jack.exclamation', true);
}
$this->loadExclamation($container, $loader, $config);

$this->loadLoaders($container, $loader, $config);
}
Expand Down Expand Up @@ -151,4 +147,30 @@ private function loadConstraint(ContainerBuilder $container, LoaderInterface $lo
$container->getDefinition('boekkooi.twig_jack.constraint_validator')
->replaceArgument(0, new Reference($config['constraint']['environment']));
}

/**
* @param array $config
* @param ContainerBuilder $container
* @param $loader
*/
public function loadExclamation(ContainerBuilder $container, $loader, array $config)
{
if (!$config['exclamation']) {
return;
}

$loader->load('exclamation.yml');

$container->getDefinition('templating.name_parser')
->setClass('%templating.name_parser.class%');

$container->getDefinition('templating.cache_warmer.template_paths')
->setClass('%templating.cache_warmer.template_paths.class%');

$container->getDefinition('assetic.twig_formula_loader')
->setClass('%assetic.twig_formula_loader.class%');


$container->setParameter('boekkooi.twig_jack.exclamation', true);
}
}
6 changes: 5 additions & 1 deletion src/DependencyInjection/Compiler/ExclamationPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ class ExclamationPass implements CompilerPassInterface
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('templating.cache_warmer.template_paths') || !$container->hasParameter('boekkooi.twig_jack.exclamation') || !$container->getParameter('boekkooi.twig_jack.exclamation')) {
if (
!$container->hasDefinition('templating.cache_warmer.template_paths') ||
!$container->hasParameter('boekkooi.twig_jack.exclamation') ||
!$container->getParameter('boekkooi.twig_jack.exclamation')
) {
return;
}

Expand Down
Loading

0 comments on commit c8025bd

Please sign in to comment.