Skip to content

Commit

Permalink
feature #20547 [FrameworkBundle] Allowed symlinks when searching for …
Browse files Browse the repository at this point in the history
…translation, searialization and validation files (tifabien)

This PR was squashed before being merged into the 3.3-dev branch (closes #20547).

Discussion
----------

[FrameworkBundle] Allowed symlinks when searching for translation, searialization and validation files

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

When we have a symlink folder in app/Resources/translations, files inside this symlink are not handled.

Commits
-------

4874e43 [FrameworkBundle] Allowed symlinks when searching for translation, searialization and validation files
  • Loading branch information
fabpot committed Jan 6, 2017
2 parents dda3760 + 4874e43 commit 6f6100a
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -893,6 +893,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder

$files = array();
$finder = Finder::create()
->followLinks()
->files()
->filter(function (\SplFileInfo $file) {
return 2 === substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename());
Expand Down Expand Up @@ -1004,10 +1005,10 @@ private function getValidatorMappingFiles(ContainerBuilder $container)
}

if (is_dir($dir = $dirname.'/Resources/config/validation')) {
foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) {
foreach (Finder::create()->followLinks()->files()->in($dir)->name('*.xml') as $file) {
$files[0][] = $file->getPathname();
}
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
foreach (Finder::create()->followLinks()->files()->in($dir)->name('*.yml') as $file) {
$files[1][] = $file->getPathname();
}

Expand Down Expand Up @@ -1187,13 +1188,13 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
}

if (is_dir($dir = $dirname.'/Resources/config/serialization')) {
foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) {
foreach (Finder::create()->followLinks()->files()->in($dir)->name('*.xml') as $file) {
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($file->getPathname()));
$definition->setPublic(false);

$serializerLoaders[] = $definition;
}
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
foreach (Finder::create()->followLinks()->files()->in($dir)->name('*.yml') as $file) {
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file->getPathname()));
$definition->setPublic(false);

Expand Down

0 comments on commit 6f6100a

Please sign in to comment.