Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an option to disable Locale listener #235

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function getConfigTreeBuilder()
->booleanNode('translation_fallback')->defaultFalse()->end()
->booleanNode('persist_default_translation')->defaultFalse()->end()
->booleanNode('skip_translation_on_load')->defaultFalse()->end()
->booleanNode('use_request_locale')->defaultTrue()->end()
->end()
;

Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/StofDoctrineExtensionsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function load(array $configs, ContainerBuilder $container)
$this->documentManagers[$name] = $listeners;
}

if ($useTranslatable) {
if ($useTranslatable && $config['use_request_locale']) {
$container->getDefinition('stof_doctrine_extensions.event_listener.locale')
->setPublic(true)
->addTag('kernel.event_subscriber');
Expand Down
3 changes: 3 additions & 0 deletions Resources/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ the asked language. If you don't provide it explicitly, it will default to
stof_doctrine_extensions:
default_locale: en_US

# If you use Translatable extension, by default the Symfony2 current locale (from the Request) is used to fetch translated query results.
use_request_locale: true

# Only used if you activated the Uploadable extension
uploadable:
# Default file path: This is one of the three ways you can configure the path for the Uploadable extension
Expand Down