Skip to content

Commit

Permalink
Merge pull request #256 from catharsisjelly/issue/255-default-locale-…
Browse files Browse the repository at this point in the history
…fallback

Changed to match the LocaleListener constructor
  • Loading branch information
dbu committed Mar 29, 2016
2 parents 4db94fa + bb936a7 commit b3f9c4c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
-----

Expand Down
5 changes: 3 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/DoctrinePHPCRExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b3f9c4c

Please sign in to comment.