Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Sep 10, 2018

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Sep 9, 2018

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.

@chalasr chalasr force-pushed the deprec-ct-aware-cmd branch from d962935 to 744bf0e Compare September 10, 2018 08:15
@chalasr
Copy link
Member Author

chalasr commented Sep 10, 2018

rebased

@fabpot
Copy link
Member

fabpot commented Sep 10, 2018

Thank you @chalasr.

@fabpot fabpot merged commit 744bf0e into symfony:master Sep 10, 2018
fabpot added a commit that referenced this pull request Sep 10, 2018
…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
@chalasr chalasr deleted the deprec-ct-aware-cmd branch September 10, 2018 08:36
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Sep 10, 2018
…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
@Tobion
Copy link
Contributor

Tobion commented Oct 11, 2018

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.

@HTMLGuyLLC
Copy link

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?

@chalasr
Copy link
Member Author

chalasr commented Mar 29, 2019

@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.
If it does not help, please open a new issue rather than commenting on a merged PR. Thanks.

@HTMLGuyLLC
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants