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

[FrameworkBundle] Deprecate auto-injection of the container in AbstractController instances #27462

Merged
merged 1 commit into from Jun 4, 2018

Conversation

nicolas-grekas
Copy link
Member

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

Should enhance DX by preventing situations like #27436.

Copy link
Contributor

@curry684 curry684 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair solution for the main underlying confusing issue.

}

private function configureController($controller)
private function configureController($controller, $class)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string $class ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

$controller->setContainer($previousContainer);
if ($controller instanceof AbstractController) {
$previousContainer = $controller->setContainer($this->container);
if (null !== $previousContainer) {
Copy link
Member

@dunglas dunglas Jun 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test can maybe be inverted if (null === $previousContainer) else for clarity?

@nicolas-grekas nicolas-grekas merged commit e2f344f into symfony:master Jun 4, 2018
nicolas-grekas added a commit that referenced this pull request Jun 4, 2018
…ainer in AbstractController instances (nicolas-grekas)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[FrameworkBundle] Deprecate auto-injection of the container in AbstractController instances

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

Should enhance DX by preventing situations like #27436.

Commits
-------

e2f344f [FrameworkBundle] Deprecate auto-injection of the container in AbstractController instances
@nicolas-grekas nicolas-grekas deleted the deprece-auto-aware branch June 9, 2018 11:46
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
This was referenced Nov 3, 2018
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.

None yet

9 participants