bug #30261 [Translation] restore compatibility with FrameworkBundle 4.2 (xabbuh)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Translation] restore compatibility with FrameworkBundle 4.2
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30260
| License | MIT
| Doc PR |
Commits
-------
45dde5d00c
restore compatibility with FrameworkBundle 4.2
This commit is contained in:
commit
f02c97f857
@ -72,12 +72,18 @@ class TranslatorPass implements CompilerPassInterface
|
||||
if ($container->hasDefinition($this->debugCommandServiceId)) {
|
||||
$definition = $container->getDefinition($this->debugCommandServiceId);
|
||||
$definition->replaceArgument(4, $container->getParameter('twig.default_path'));
|
||||
$definition->replaceArgument(6, $paths);
|
||||
|
||||
if (\count($definition->getArguments()) > 6) {
|
||||
$definition->replaceArgument(6, $paths);
|
||||
}
|
||||
}
|
||||
if ($container->hasDefinition($this->updateCommandServiceId)) {
|
||||
$definition = $container->getDefinition($this->updateCommandServiceId);
|
||||
$definition->replaceArgument(5, $container->getParameter('twig.default_path'));
|
||||
$definition->replaceArgument(7, $paths);
|
||||
|
||||
if (\count($definition->getArguments()) > 7) {
|
||||
$definition->replaceArgument(7, $paths);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,4 +82,41 @@ class TranslationPassTest extends TestCase
|
||||
$this->assertSame($expectedViewPaths, $debugCommand->getArgument(6));
|
||||
$this->assertSame($expectedViewPaths, $updateCommand->getArgument(7));
|
||||
}
|
||||
|
||||
public function testCommandsViewPathsArgumentsAreIgnoredWithOldServiceDefinitions()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('translator.default')
|
||||
->setArguments([null, null, null, null])
|
||||
;
|
||||
$debugCommand = $container->register('console.command.translation_debug')
|
||||
->setArguments([
|
||||
new Reference('translator'),
|
||||
new Reference('translation.reader'),
|
||||
new Reference('translation.extractor'),
|
||||
'%translator.default_path%',
|
||||
null,
|
||||
])
|
||||
;
|
||||
$updateCommand = $container->register('console.command.translation_update')
|
||||
->setArguments([
|
||||
new Reference('translation.writer'),
|
||||
new Reference('translation.reader'),
|
||||
new Reference('translation.extractor'),
|
||||
'%kernel.default_locale%',
|
||||
'%translator.default_path%',
|
||||
null,
|
||||
])
|
||||
;
|
||||
$container->register('twig.template_iterator')
|
||||
->setArguments([null, null, ['other/templates' => null, 'tpl' => 'App']])
|
||||
;
|
||||
$container->setParameter('twig.default_path', 'templates');
|
||||
|
||||
$pass = new TranslatorPass('translator.default');
|
||||
$pass->process($container);
|
||||
|
||||
$this->assertSame('templates', $debugCommand->getArgument(4));
|
||||
$this->assertSame('templates', $updateCommand->getArgument(5));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user