Skip to content
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

[Bundles] Allow to customize the entire dir structure #32453

Closed
javiereguiluz opened this issue Jul 9, 2019 · 11 comments

Comments

@javiereguiluz
Copy link
Member

commented Jul 9, 2019

Description
I'd love to allow bundles to have the exact same dir structure as full Symfony apps. It's such a concise, beautiful and self-explanatory structure!

So, now that we've added getPublicDir() in #31975 ... what about adding the rest of methods needed to customize the dir structure?

  • getConfigDir()
  • getTemplatesDir()
  • getTranslationsDir()

src/ and tests/ can be customized in other ways (Composer, PHPUnit, etc.)

@yceruto

This comment has been minimized.

Copy link
Member

commented Jul 9, 2019

A big 👍 for directory customization.

According to #31975 all methods should be called ...Path(), they are relative paths to the bundle path.

I can take getTemplatesPath() and getTranslationsPath() so far.

@javiereguiluz

This comment has been minimized.

Copy link
Member Author

commented Jul 9, 2019

We may rename getPublicPath() as getPublicDir() (see #32452) because all dirs are paths but not all paths are dirs (and here we always need a dir).

@linaori

This comment has been minimized.

Copy link
Contributor

commented Jul 9, 2019

Configuration over convention, I like it!

@ro0NL

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

while i like the intend, should we really assume all bundles have such concepts? Is there any downside for, let's say, low-level library bundles?

Not sure, but maybe a global framework PathProvider concept might work, to let both the kernel and bundles provision paths as needed (e.g. interface based).

Ultimately this already applies to the "public dir", not all bundles have this concept.

@derrabus

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

I like the idea of having a configurable directory structure! Just a small question:

  • getConfigDir()

Is this really a hardcoded convention right now? This should be configurable via the extension already.

$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

@emodric

This comment has been minimized.

Copy link
Contributor

commented Jul 12, 2019

Is this really a hardcoded convention right now?

Some code probably uses the hardcoded path, I think. Doctrine ORM mappings and validator component config (validation.yml) come to mind.

@ro0NL

This comment has been minimized.

Copy link
Contributor

commented Jul 12, 2019

But then overriding getConfigDir in your bundle requires another change in your extension, so we're not really solving anything for the user :}

@javiereguiluz

This comment has been minimized.

Copy link
Member Author

commented Jul 12, 2019

@ro0NL if this proposal is approved, we'll update all the first-party bundles and the most important third-party bundles to be sure that they are using the new methods.

@ro0NL

This comment has been minimized.

Copy link
Contributor

commented Jul 12, 2019

@javiereguiluz how will an extension retrieve the bundle or the path? I think we're hitting a design limitation at this point, but i may miss it... haven't looked into it in depth.

@nicolas-grekas

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

We cannot get rid of conventions unless we change the design completely.
I also think standardization is a useful property of the current system.
If we think a different layout would be better, let's make it work in FrameworkExtension and done.
Bundles are meant to be shared, and shared means the more standards the better.

@yceruto

This comment has been minimized.

Copy link
Member

commented Aug 1, 2019

Here we go -> #32845 🤞

symfony-splitter pushed a commit to symfony/framework-bundle that referenced this issue Aug 13, 2019
feature #32845 [HttpKernel][FrameworkBundle] Add alternative conventi…
…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 | 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
nicolas-grekas added a commit that referenced this issue Aug 13, 2019
feature #32845 [HttpKernel][FrameworkBundle] Add alternative conventi…
…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
symfony-splitter pushed a commit to symfony/twig-bundle that referenced this issue Aug 13, 2019
feature #32845 [HttpKernel][FrameworkBundle] Add alternative conventi…
…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 | 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
symfony-splitter pushed a commit to symfony/doctrine-bridge that referenced this issue Aug 13, 2019
feature #32845 [HttpKernel][FrameworkBundle] Add alternative conventi…
…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 | 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
symfony-splitter pushed a commit to symfony/http-kernel that referenced this issue Aug 13, 2019
feature #32845 [HttpKernel][FrameworkBundle] Add alternative conventi…
…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 | 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.