From f5c0a6918adb503a135ad391a4e186a1cf742e23 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 12 Feb 2015 17:47:02 +0000 Subject: [PATCH] [FrameworkBundle] Enable assets by default. --- .../DependencyInjection/Configuration.php | 20 +++++++++++++++++++ .../DependencyInjection/ConfigurationTest.php | 7 +++++++ .../Bundle/FrameworkBundle/composer.json | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 95aa34c50ef7..72485734a299 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -53,6 +53,26 @@ public function getConfigTreeBuilder() return $v; }) ->end() + ->validate() + ->ifTrue(function ($v) { return !isset($v['assets']); }) + ->then(function ($v) { + if (!$v['templating']['assets_version'] + && !count($v['templating']['assets_base_urls']['http']) + && !count($v['templating']['assets_base_urls']['ssl']) + && !count($v['templating']['packages']) + ) { + $v['assets'] = array( + 'version' => null, + 'version_format' => '%%s?%%s', + 'base_path' => '', + 'base_urls' => array(), + 'packages' => array(), + ); + } + + return $v; + }) + ->end() ->validate() ->ifTrue(function ($v) { return isset($v['templating']); }) ->then(function ($v) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index bbe54e9eb6a6..83b8a9560282 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -145,6 +145,13 @@ protected static function getBundleDefaultConfig() 'magic_call' => false, 'throw_exception_on_invalid_index' => false, ), + 'assets' => array( + 'version' => null, + 'version_format' => '%%s?%%s', + 'base_path' => '', + 'base_urls' => array(), + 'packages' => array(), + ), ); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 6d57657ef10d..485051c4cd5c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -17,6 +17,7 @@ ], "require": { "php": ">=5.3.9", + "symfony/asset": "~2.7|~3.0.0", "symfony/dependency-injection" : "~2.6,>=2.6.2", "symfony/config" : "~2.4", "symfony/event-dispatcher": "~2.5|~3.0.0", @@ -48,7 +49,6 @@ "symfony/yaml": "~2.0,>=2.0.5|~3.0.0" }, "suggest": { - "symfony/asset": "", "symfony/console": "For using the console commands", "symfony/finder": "For using the translation loader and cache warmer", "symfony/form": "For using forms",