8000 feature #21231 [FrameworkBundle] allow to reference files directly fr… · symfony/symfony@bdd0f9d · GitHub
[go: up one dir, main page]

Skip to content

Commit bdd0f9d

Browse files
committed
feature #21231 [FrameworkBundle] allow to reference files directly from kernel.root_dir (fabpot)
This PR was merged into the 3.3-dev branch. Discussion ---------- [FrameworkBundle] allow to reference files directly from kernel.root_dir | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a While working on a bundleless app, I want to be able to reference a directory for routing annotations like this: ```yaml app: resource: "../src/Controller/" type: annotation ``` but that does not work because Symfony expects a bundle resource (`@AppBundle...`) or a directory referenced from the main app `Resources` directory. But as I don't have such a directory, even using `../../src/Controller` does not work. So, I propose to add the %kernel.root_dir% to the list of allowed directories. By the way, we don't have the same issue with the routing annotation **file** loader as it does not use the locator for whatever reason. Should we fix it? Commits ------- 80b61e9 [FrameworkBundle] allowed to reference files directly from kernel.root_dir
2 parents 4d916c6 + 80b61e9 commit bdd0f9d

File tree

1 file changed

+3
-0
lines changed
  • src/Symfony/Bundle/FrameworkBundle/Resources/config

1 file changed

+3
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
<service id="file_locator" class="Symfony\Component\HttpKernel\Config\FileLocator">
5353
<argument type="service" id="kernel" />
5454
<argument>%kernel.root_dir%/Resources</argument>
55+
<argument type="collection">
56+
<argument>%kernel.root_dir%</argument>
57+
</argument>
5558
</service>
5659

5760
<service id="uri_signer" class="Symfony\Component\HttpKernel\UriSigner">

0 commit comments

Comments
 (0)
0