-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HttpKernel][FrameworkBundle] Add alternative convention for bundle directories #32845
Conversation
As I wrote in #32453 (comment), I'm not sure we want to make dirs configurable. Even getPublicDir is suspicious to me. |
I think making them configurable isn't necessarily what I want, it's the confusing structure it has right now I'd like to change. Making dirs configurable is one way to do this, because it means I don't have to follow the current structure and that it provides a migration path to change the default. I very much prefer the structure as shown in the example. The fact that the non-code directory is called "Resources" (mind you, capital R) is bothering me since the start. the "views" directory isn't named correctly anymore either as it's called "templates" in Symfony. Not sure if the proposed API is a good idea, but I do think that the bundle is responsible for the exposure of certain directories.
Symfony telling where everything should be feels like something we could change, though it should have sane defaults. I don't agree with the current structure being a sane default anymore due to the changes in the Symfony structure; |
what if we create a single entrypoint similar like with a built-in deprecation for for DI extensions we should also consider injecting the config dir somehow, or access to any path for that matter |
src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/ModernBundle/ModernBundle.php
Outdated
Show resolved
Hide resolved
I'm fine if it's not configurable, but we still want a new bundle directory structure, do you want it too?
@ro0NL we shouldn't deprecating yet ->
I'm not sure it's necessary, you can hardcode it safely there, it's in userland. |
yes! that'd look consistent with the new directory structure of apps I'd just do it in |
Update Removed the configuration of the bundle directory, it is now a new convension that we can optionally use as of 4.4 version. Added The current convention is not being obsolete yet, it will (in the future). Convention from 3rd-party bundles like Doctrine ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this approach :)
What's the purpose of getPath now? Should we deprecated it? Or should we plan to deprecate it in 5.1, to help bundles migrate smoothly?
I think that as of 5.2 (NOV 2020) where we should start to deprecating the legacy structure as well. That'll match with the end of support for 3.4. |
Sorry for the rebasing after the approved revisions, I needed to update my PhpUnit bridge to make my local phpunit work properly. Status: This Is Ready In My Side ;) |
5de3197
to
12c4c16
Compare
12c4c16
to
6996e1c
Compare
Thank you @yceruto. |
…on 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 | #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 #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 ------- 6996e1c [HttpKernel][FrameworkBundle] Add alternative convention for bundle directories
Yujuuu!! 🎉 |
Hi,
Are there any plans to introduce the function back or remove it from documentation? |
Yes, it should be removed from the documentation (leftover of #31975) |
This PR was merged into the 4.4 branch. Discussion ---------- remove getPublicDir() documentation see symfony/symfony#32845 (comment) Commits ------- e3fa2e6 remove getPublicDir() documentation
…e (yceruto) This PR was squashed before being merged into the 4.4 branch. Discussion ---------- Promoting new bundle directory structure as best practice As Symfony 3.4 is not currently supported (security fixes only) I would like to propose to start promoting the new bundle directory structure (compatible since 4.4) consistent with the project one. What do you think? Fix: #12156 PR: symfony/symfony#32845 Commits ------- d44bfa8 Promoting new bundle directory structure as best practice
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 #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:
WDYT?