From bb936a730037ac4d6451771fe7ebdb79c8b5231b Mon Sep 17 00:00:00 2001 From: Chris Lock Date: Mon, 29 Feb 2016 16:05:47 +0000 Subject: [PATCH] Changed to match the LocaleListener constructor --- CHANGELOG.md | 6 ++++++ DependencyInjection/Configuration.php | 5 +++-- DependencyInjection/DoctrinePHPCRExtension.php | 2 +- Tests/Unit/DependencyInjection/ConfigurationTest.php | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2f9606a..e9334aeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========= +1.3.3 +----- + +* Since version 1.3.0 `LocaleListener` has treated the `locale_fallback` strategy 'hardcoded' as 'merge', this is now + rectified so and the default behaviour is now 'merge' + 1.3.2 ----- diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 8b5085f9..ccc069a4 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -20,6 +20,7 @@ namespace Doctrine\Bundle\PHPCRBundle\DependencyInjection; +use Doctrine\Bundle\PHPCRBundle\EventListener\LocaleListener; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; @@ -239,8 +240,8 @@ private function addOdmSection(ArrayNodeDefinition $node) ->defaultNull() ->end() ->enumNode('locale_fallback') - ->values(array('hardcoded', 'merge', 'replace')) - ->defaultValue('hardcoded') + ->values(array(LocaleListener::FALLBACK_HARDCODED, LocaleListener::FALLBACK_MERGE, LocaleListener::FALLBACK_REPLACE)) + ->defaultValue(LocaleListener::FALLBACK_MERGE) ->end() ->scalarNode('default_locale')->end() ->arrayNode('namespaces') diff --git a/DependencyInjection/DoctrinePHPCRExtension.php b/DependencyInjection/DoctrinePHPCRExtension.php index 9c0be79b..0ab16943 100644 --- a/DependencyInjection/DoctrinePHPCRExtension.php +++ b/DependencyInjection/DoctrinePHPCRExtension.php @@ -409,7 +409,7 @@ private function loadOdmLocales(array $config, ContainerBuilder $container) } $container->setParameter('doctrine_phpcr.odm.default_locale', $defaultLocale); $container->setParameter('doctrine_phpcr.odm.default_locale', key($config['locales'])); - $container->setParameter('doctrine_phpcr.odm.locale_fallback', $config['locale_fallback'] == 'hardcoded' ? null : $config['locale_fallback']); + $container->setParameter('doctrine_phpcr.odm.locale_fallback', $config['locale_fallback']); $localeChooser = $localeChooser ?: 'doctrine_phpcr.odm.locale_chooser'; } diff --git a/Tests/Unit/DependencyInjection/ConfigurationTest.php b/Tests/Unit/DependencyInjection/ConfigurationTest.php index 073be596..49e8b48b 100644 --- a/Tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/Tests/Unit/DependencyInjection/ConfigurationTest.php @@ -178,7 +178,7 @@ public function configurations() 'proxy_namespace' => 'PHPCRProxies', 'locales' => array( ), - 'locale_fallback' => 'hardcoded', + 'locale_fallback' => 'merge', 'document_managers' => array( 'default' => array( 'auto_mapping' => false,