Skip to content

Commit a9ac199

Browse files
feature #32845 [HttpKernel][FrameworkBundle] Add alternative convention for bundle directories (yceruto)
This PR was squashed before being merged into the 4.4 branch (closes #32845). Discussion ---------- [HttpKernel][FrameworkBundle] Add alternative convention for bundle directories | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony/symfony#32453 | License | MIT | Doc PR | TODO We already know that bundles must be compatible with many Symfony's versions, so it is very likely that current bundles won't be able to use this feature soon, unless they create symbolic links to support both structures. The point is that this is already happening, so in the future when our bundles stop to support <=4.3 then you'll be sure to change the current directory structure. We have recently added the `getPublicDir()` method in symfony/symfony#31975, here I'm removing it in favor of hardcoding a new convention. I've added some functional tests in which I've changed everything to this structure: ``` -- ModernBundle |-- config/ |-- public/ |-- src/ |-- ModernBundle.php |-- templates/ |-- translations/ ``` WDYT? Commits ------- 6996e1cbe2 [HttpKernel][FrameworkBundle] Add alternative convention for bundle directories
2 parents 3b89d04 + 58c4855 commit a9ac199

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

DependencyInjection/CompilerPass/DoctrineValidationPass.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ private function updateValidatorMappingFiles(ContainerBuilder $container, string
4848
}
4949

5050
$files = $container->getParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files');
51-
$validationPath = 'Resources/config/validation.'.$this->managerType.'.'.$extension;
51+
$validationPath = '/config/validation.'.$this->managerType.'.'.$extension;
5252

53-
foreach ($container->getParameter('kernel.bundles') as $bundle) {
54-
$reflection = new \ReflectionClass($bundle);
55-
if ($container->fileExists($file = \dirname($reflection->getFileName()).'/'.$validationPath)) {
53+
foreach ($container->getParameter('kernel.bundles_metadata') as $bundle) {
54+
if ($container->fileExists($file = $bundle['path'].'/Resources'.$validationPath) || $container->fileExists($file = $bundle['path'].$validationPath)) {
5655
$files[] = $file;
5756
}
5857
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy