8000 Adding that you cannot access a session inside a constructor by ThomasLandauer · Pull Request #16985 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Adding that you cannot access a session inside a constructor #16985

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
Aug 23, 2022

Conversation

ThomasLandauer
Copy link
Contributor

Please double-check!
The info is taken from PhpStorm's Symfony Plugin: https://espend.de/phpstorm/plugin/symfony#inspections:

A Session must not be used inside a constructor

I think this should be explained here, since doing $this->session = $requestStack->getSession(); right in the constructor looked like a nice idea...

@wouterj wouterj changed the base branch from 6.1 to 5.4 August 23, 2022 15:51
@wouterj wouterj requested a review from xabbuh as a code owner August 23, 2022 15:51
@wouterj
Copy link
Member
wouterj commented Aug 23, 2022

Thank you!

@wouterj wouterj merged commit 52d1c55 into symfony:5.4 Aug 23, 2022
@ThomasLandauer ThomasLandauer deleted the patch-23 branch August 23, 2022 18:30
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.

4 participants
0