-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Fix BC break in console.command.ids parameter #24073
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e1894a3
to
706b556
Compare
Would it be acceptable to backport
|
@ogizanagi That was my first intention, but in symfony/flex#142 (comment) @stof pointed that adding invalid service ids in the |
706b556
to
99e95c3
Compare
nicolas-grekas
approved these changes
Sep 8, 2017
Thank you @chalasr. |
fabpot
added a commit
that referenced
this pull request
Sep 8, 2017
…(chalasr) This PR was merged into the 3.4 branch. Discussion ---------- [Console] Fix BC break in console.command.ids parameter | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony/flex#142 (comment) | License | MIT | Doc PR | n/a To make command services lazy loaded when their name is known, we need to exclude them from [runtime registration of other (non lazy-loadable) command services](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Console/Application.php#L176). We also need to have them in the `console.command.ids` parameter in order to [not register them by convention](https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/HttpKernel/Bundle/Bundle.php#L188). It is managed using `false` as values instead of ids for the parameter, [excluding false values from runtime registration](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Console/Application.php#L177). Problem is that it makes FrameworkBundle's 3.3 Application incompatible with Console 3.4+ given the check for `false` is missing. This PR fixes it using another parameter referencing ids of command services which can be lazy loaded. I would be happy to not add the parameter if someone has a suggestion that allows to do so. Commits ------- 99e95c3 Fix BC break in console.command.ids parameter
chalasr
pushed a commit
that referenced
this pull request
Dec 25, 2017
This PR was merged into the 4.0 branch. Discussion ---------- [Console] Simplify parameters in DI | Q | A | ------------- | --- | Branch? | 4.0 | Bug fix? | no | New feature? |no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Currently the container gets filled with alot of ugly params like ``` 'console.command.ids' => array( 'console.command.symfony_bundle_frameworkbundle_command_aboutcommand' => 'console.command.about', 'console.command.symfony_bundle_frameworkbundle_command_assetsinstallcommand' => 'console.command.assets_install', 'console.command.symfony_bundle_frameworkbundle_command_cacheclearcommand' => 'console.command.cache_clear', ... ), 'console.lazy_command.ids' => array( 'console.command.about' => true, 'console.command.assets_install' => true, 'console.command.cache_clear' => true, ... ``` We can get rid of these in 4.0 with a little refactoring. - SF 4.0 does not include the auto-registration of commands anymore which was the reason why the `console.command.ids` used the class name as index to prevent commands already defined as service to not triggger auto-registration. -> The param does not need the index lookup anymore in 4.0 - What I now also changed is that this param only contains the command IDs of services that are NOT lazy loaded. This way, we don't need `console.lazy_command.ids` at all. This is a simplification of #24073 and still ensures framework bundle console application is compatible with console component 3.x and 4.x Commits ------- ae47805 [Console] Simplify parameters in DI
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To make command services lazy loaded when their name is known, we need to exclude them from runtime registration of other (non lazy-loadable) command services.
We also need to have them in the
console.command.ids
parameter in order to not register them by convention.It is managed using
false
as values instead of ids for the parameter, excluding false values from runtime registration. Problem is that it makes FrameworkBundle's 3.3 Application incompatible with Console 3.4+ given the check forfalse
is missing.This PR fixes it using another parameter referencing ids of command services which can be lazy loaded.
I would be happy to not add the parameter if someone has a suggestion that allows to do so.