Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] Deprecate AbstractController::get() and has()#42442

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@fabpot
Copy link
Member

QA
Branch?5.4
Bug fix?no
New feature?no
Deprecations?yes
Ticketsn/a
LicenseMIT
Doc PRn/a

Controllers extendingAbstractController have access to the services registered for the shortcuts defined inAbstractController viaget() andhas(). These methods can make developers think that they have access to the whole container, which is not true. Moreover, the limited set of services are precisely the ones needed for the shortcuts, so probably not the ones people would need anyway.

I propose to deprecate these methods and advocate using method/constructor injection instead.

If people want to still use the container, they can access it via the$this->container property (useful if they extendgetSubscribedServices() for instance).

BafS, TomasVotruba, and fmonts reacted with thumbs up emoji
@fabpotfabpotforce-pushed theabstract-controller-get-has-deprecation branch from762cfc1 toeb14ee5CompareAugust 9, 2021 08:45
@fabpotfabpotforce-pushed theabstract-controller-get-has-deprecation branch fromeb14ee5 tof4ee152CompareAugust 9, 2021 08:46
@fabpotfabpotforce-pushed theabstract-controller-get-has-deprecation branch fromf4ee152 to66a81eaCompareAugust 9, 2021 09:01
@fabpotfabpot merged commit8ac480a intosymfony:5.4Aug 9, 2021
@fabpotfabpot deleted the abstract-controller-get-has-deprecation branchAugust 9, 2021 10:21
This was referencedNov 5, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@OskarStarkOskarStarkOskarStark approved these changes

@derrabusderrabusderrabus approved these changes

+1 more reviewer

@zairigimadzairigimadzairigimad approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

6 participants

@fabpot@nicolas-grekas@OskarStark@derrabus@zairigimad@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp