Skip to content

Commit

Permalink
Fix BC with Symfony 2.8 LTS (#322)
Browse files Browse the repository at this point in the history
* If the container has the parameter project_dir use that one, otherwise
use the root_dir

* Use the Kernel Version ID instead
  • Loading branch information
SanderVerkuil authored and Gilles Gauthier committed May 18, 2018
1 parent 4825bc5 commit 2657f57
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion DependencyInjection/LexikTranslationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,18 @@ public function prepend(ContainerBuilder $container)
return;
}

$rootDir = 'vendor/lexik/translation-bundle/Resources/views';

// Only symfony versions >= 3.3 include the kernel.project_dir parameter
if (Kernel::VERSION_ID >= 30300) {
$rootDir = '%kernel.project_dir%/'.$rootDir;
} else {
$rootDir = '%kernel.root_dir%/../'.$rootDir;
}

$container->prependExtensionConfig('twig', [
'paths' => [
'%kernel.project_dir%/vendor/lexik/translation-bundle/Resources/views' => 'LexikTranslationBundle'
$rootDir => 'LexikTranslationBundle'
]
]);
}
Expand Down

1 comment on commit 2657f57

@7tomas7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$rootDir => 'LexikTranslationBundle' should be I think $rootDir => 'LexikTranslation'

Please sign in to comment.