Skip to content

Do not throw exception when SF Translation collector is not found. #108

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

Merged
merged 2 commits into from
Jul 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DependencyInjection/CompilerPass/SymfonyProfilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public function process(ContainerBuilder $container)
}

if (!$container->hasDefinition('translator.data_collector')) {
throw new \LogicException('[PHP-Translation] To integrate with the Symfony profiler you first need to enable it. Please set framework.translator.enabled: true');
// No Symfony translation data collector was found. We cannot use our collection without it.
$container->removeDefinition('php_translation.data_collector');
}
}
}
18 changes: 17 additions & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,30 @@ public function getConfigTreeBuilder()
$this->addEditInPlaceNode($root);
$this->addWebUINode($root);

$debug = $this->container->getParameter('kernel.debug');
$root
->children()
->arrayNode('locales')
->prototype('scalar')->end()
->end()
->scalarNode('default_locale')->info('Your default language or fallback locale. Default will be kernel.default_locale')->end()
->arrayNode('symfony_profiler')
->canBeEnabled()
->addDefaultsIfNotSet()
->treatFalseLike(['enabled' => false])
->treatTrueLike(['enabled' => true])
->treatNullLike(['enabled' => $debug])
->info('Extend the debug profiler with information about requests.')
->children()
->booleanNode('enabled')
->info('Turn the symfony profiler integration on or off. Defaults to kernel debug mode.')
->defaultValue($debug)
->end()
->scalarNode('formatter')->defaultNull()->end()
->integerNode('captured_body_length')
->defaultValue(0)
->info('Limit long HTTP message bodies to x characters. If set to 0 we do not read the message body. Only available with the default formatter (FullHttpMessageFormatter).')
->end()
->end()
->children()
->booleanNode('allow_edit')->defaultTrue()->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected function getContainerExtensions()
{
$this->setParameter('kernel.default_locale', 'ar');
$this->setParameter('kernel.root_dir', __DIR__);
$this->setParameter('kernel.debug', true);

return [
new TranslationExtension(),
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "0.4-dev"
Expand Down