Skip to content

When overriding session service definition, make it public #11993

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
Jul 22, 2019

Conversation

pbowyer
Copy link
Contributor

@pbowyer pbowyer commented Jul 19, 2019

Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait::addFlash() relies on getting the session service from the service container.

Since 3.4 services defined in services.yaml are private by default. When overriding the session service definition, it has to be explicitly marked as public.

The 4.2 documentation branch was the earliest I found containing this example service definition.

`Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait::addFlash()` relies on getting the `session` service from the service container.

Since 3.4 services defined in `services.yaml` are private by default. When overriding the `session`  service definition, it has to be explicitly marked as public.
Copy link
Contributor

@OskarStark OskarStark left a comment

Choose a reason for hiding this comment

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

Thank you! It would be great if you could add the missing xml and php config parts too, but this would just be a nice addition and is no blocker for this PR 🙏👌🏻

@xabbuh xabbuh added this to the 4.2 milestone Jul 19, 2019
@javiereguiluz
Copy link
Member

Thanks Peter!

@javiereguiluz javiereguiluz merged commit 315103f into symfony:4.2 Jul 22, 2019
javiereguiluz added a commit that referenced this pull request Jul 22, 2019
…blic (pbowyer)

This PR was merged into the 4.2 branch.

Discussion
----------

When overriding `session` service definition, make it public

`Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait::addFlash()` relies on getting the `session` service from the service container.

Since 3.4 services defined in `services.yaml` are private by default. When overriding the `session`  service definition, it has to be explicitly marked as public.

The 4.2 documentation branch was the earliest I found containing this example service definition.

Commits
-------

315103f When overriding `session` service definition, make it public
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.

5 participants