Skip to content

[FrameworkBundle][Translation] Don't add Translation into DI when it is disabled in Config #20791

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

Closed
BPScott opened this issue Dec 6, 2016 · 2 comments

Comments

@BPScott
Copy link
Contributor

BPScott commented Dec 6, 2016

More of request for comments rater than a "hey this is certainly a bug"...

Using Symfony 3.2 I have disabled translation, validation and form in my FrameworkBundle config as I do not require these items in my application (it's a JSON API). I have confirmed this by running app/console debug:config FrameworkBundle and noting that those three items all state enabled: false.

When I run app/console debug:container I note that the form and validator services are now absent, however translation services are still registered. This is particularly annoying as there are 28 of them.

Is it possible for the translate service config to not be loaded if it (and everything that depends upon it) has been disabled in the config?

Looking at the extension config I note that forms require translation. Perhaps this could be reworked in a similar manner to the validation registration so that it is only forced to load if the form component is also enabled.

@BPScott BPScott changed the title [FrameworkBundle][Translation] Don't add Translation into DI when is is disabled in Config [FrameworkBundle][Translation] Don't add Translation into DI when it is disabled in Config Dec 6, 2016
@javiereguiluz
Copy link
Member

👍

This goes along changes like the one we introduced recently in FrameExtraBundle to not enable unnecessary things: https://github.com/sensiolabs/SensioFrameworkExtraBundle/issues/427

@xabbuh
Copy link
Member

xabbuh commented Dec 14, 2016

see #20928 for a first attempt to clean this up a bit

fabpot added a commit that referenced this issue Dec 16, 2016
…t required (xabbuh)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle] don't load translator services if not required

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

One step further could be to remove all the loader services (or not register them at all) if only the identity translator is used (i.e. when only forms are enabled, but not translations), but that could be seen as a BC break.

Commits
-------

1e67155 don't load translator services if not required
@fabpot fabpot closed this as completed Dec 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants