-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Deprecate ContainerAwareCommand #28415
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
Conversation
d962935
to
744bf0e
Compare
rebased |
Thank you @chalasr. |
…lasr) This PR was merged into the 4.2-dev branch. Discussion ---------- [FrameworkBundle] Deprecate ContainerAwareCommand | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | symfony/symfony-docs#10307 Follow up of the recent `Controller` deprecation. I think people are widely used to register their commands as services and use proper dependency injection, we made the move for core commands in 3.4, let's deprecate `ContainerAwareCommand` for 4.2. Commits ------- 744bf0e [FrameworkBundle] Deprecate ContainerAwareCommand
…AwareCommand (chalasr, javiereguiluz) This PR was merged into the master branch. Discussion ---------- [Console] Remove mentions about the deprecated ContainerAwareCommand Related to symfony/symfony#28415 Commits ------- 4143835 Maintained a note about ContainerAwareCommand being deprecated f3e8f0e [WCM][Console] Remove mentions about the deprecated ContainerAwareCommand class
The swiftmailer-bundle (https://github.com/symfony/swiftmailer-bundle/tree/master/Command) and doctrine-bundle (https://github.com/doctrine/DoctrineBundle/blob/master/Command/DoctrineCommand.php) need to be fixed for this. |
Ok, so I was updating my code to remove this deprecated class and I ran into a potential roadblock. Without rewriting code, how can I call a controller in a command without the container being accessible like it was previously? |
@HTMLGuyLLC The deprecation notice says "use dependency-injection instead". Your controller is a service, you should be able to inject it in your command as any dependency. |
@chalasr I know what it says and that's what I'm doing with all my other dependencies. I didn't know the container was a service. Thank you. |
Follow up of the recent
Controller
deprecation.I think people are widely used to register their commands as services and use proper dependency injection, we made the move for core commands in 3.4, let's deprecate
ContainerAwareCommand
for 4.2.