Skip to content

Commit d7ed632

Browse files
committed
No longer keep DirectoryResources for translation dirs in container
Now that the translator keeps track of its own directories for caching the container no longer needs to do it. This means that when a translation changes or is added the container no longer needs to be fully rebuilt, saving a considerable amount of time.
1 parent a10b08d commit d7ed632

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,22 +1091,21 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
10911091
$defaultDir = $container->getParameterBag()->resolveValue($config['default_path']);
10921092
$rootDir = $container->getParameter('kernel.root_dir');
10931093
foreach ($container->getParameter('kernel.bundles_metadata') as $name => $bundle) {
1094-
if ($container->fileExists($dir = $bundle['path'].'/Resources/translations')) {
1094+
if ($container->fileExists($dir = $bundle['path'].'/Resources/translations', false)) {
10951095
$dirs[] = $dir;
10961096
} else {
10971097
$nonExistingDirs[] = $dir;
10981098
}
1099-
if ($container->fileExists($dir = $rootDir.sprintf('/Resources/%s/translations', $name))) {
1099+
if ($container->fileExists($dir = $rootDir.sprintf('/Resources/%s/translations', $name), false)) {
11001100
@trigger_error(sprintf('Translations directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultDir), E_USER_DEPRECATED);
1101-
11021101
$dirs[] = $dir;
11031102
} else {
11041103
$nonExistingDirs[] = $dir;
11051104
}
11061105
}
11071106

11081107
foreach ($config['paths'] as $dir) {
1109-
if ($container->fileExists($dir)) {
1108+
if ($container->fileExists($dir, false)) {
11101109
$dirs[] = $transPaths[] = $dir;
11111110
} else {
11121111
throw new \UnexpectedValueException(sprintf('%s defined in translator.paths does not exist or is not a directory', $dir));
@@ -1121,13 +1120,13 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
11211120
$container->getDefinition('console.command.translation_update')->replaceArgument(6, $transPaths);
11221121
}
11231122

1124-
if ($container->fileExists($defaultDir)) {
1123+
if ($container->fileExists($defaultDir, false)) {
11251124
$dirs[] = $defaultDir;
11261125
} else {
11271126
$nonExistingDirs[] = $defaultDir;
11281127
}
11291128

1130-
if ($container->fileExists($dir = $rootDir.'/Resources/translations')) {
1129+
if ($container->fileExists($dir = $rootDir.'/Resources/translations', false)) {
11311130
if ($dir !== $defaultDir) {
11321131
@trigger_error(sprintf('Translations directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultDir), E_USER_DEPRECATED);
11331132
}

0 commit comments

Comments
 (0)