1919use Symfony \Component \DependencyInjection \Loader \YamlFileLoader ;
2020use Symfony \Component \DependencyInjection \Reference ;
2121use Symfony \Component \HttpKernel \DependencyInjection \Extension ;
22+ use Symfony \Component \HttpKernel \Kernel ;
2223
2324class OverblogGraphQLExtension extends Extension implements PrependExtensionInterface
2425{
@@ -31,6 +32,7 @@ public function load(array $configs, ContainerBuilder $container)
3132
3233 $ config = $ this ->treatConfigs ($ configs , $ container );
3334
35+ $ this ->setExpressionLanguageDefaultParser ($ container );
3436 $ this ->setServicesAliases ($ config , $ container );
3537 $ this ->setSchemaBuilderArguments ($ config , $ container );
3638 $ this ->setSchemaArguments ($ config , $ container );
@@ -55,6 +57,17 @@ public function prepend(ContainerBuilder $container)
5557 $ typesExtension ->containerPrependExtensionConfig ($ config , $ container );
5658 }
5759
60+ private function setExpressionLanguageDefaultParser (ContainerBuilder $ container )
61+ {
62+ $ class = version_compare (Kernel::VERSION , '3.2.0 ' , '>= ' ) ?
63+ 'Symfony \\Component \\Cache\Adapter \\ArrayAdapter '
64+ : 'Symfony \\Component \\ExpressionLanguage \\ParserCache \\ArrayParserCache '
65+ ;
66+ $ definition = new Definition ($ class );
67+ $ definition ->setPublic (false );
68+ $ container ->setDefinition ($ this ->getAlias ().'.cache_expression_language_parser.default ' , $ definition );
69+ }
70+
5871 private function setShowDebug (array $ config , ContainerBuilder $ container )
5972 {
6073 $ container ->getDefinition ($ this ->getAlias ().'.request_executor ' )->replaceArgument (4 , $ config ['definitions ' ]['show_debug_info ' ]);
0 commit comments