Skip to content

Show how to change the Session Attribute Bag type #10495

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

Closed

Conversation

pbowyer
Copy link
Contributor

@pbowyer pbowyer commented Oct 16, 2018

The Session component ships with two different attribute bag implementations, and the Symfony docs don't show how to change between them.

Fixes #10494 and StackOverflow issues like https://stackoverflow.com/questions/12279247/how-to-use-namespaced-sessions-in-symfony2

Specific feedback requests

  1. Is this the right location for it? Adding it to https://github.com/symfony/symfony-docs/blob/master/session.rst was my first idea, but everything else is sub-pages.
  2. I only use YAML configuration, so if someone else can contribute/check the PHP/XML config that would be brilliant.
  3. Hard line wrapping - you appear to use ~80 characters? I've got some lines that go over that but don't think paths to files can be split?

@pbowyer pbowyer changed the title [WIP] Show how to change the Session Attribute Bag [WIP] Show how to change the Session Attribute Bag type Oct 18, 2018
@pbowyer pbowyer changed the title [WIP] Show how to change the Session Attribute Bag type Show how to change the Session Attribute Bag type Oct 18, 2018
Copy link
Member

@xabbuh xabbuh left a comment

Choose a reason for hiding this comment

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

I think we should not replace the session service, but only replace session.attribute_bag instead.

arguments: ["@session.storage", "@session.namespacedattributebag", "@session.flash_bag"]

session.namespacedattributebag:
class: Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a new line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Below line 31?

@javiereguiluz
Copy link
Member

Peter, thanks for contributing these docs. We merged it in 4.2 branch (and then, master too) and we reworded it a bit. Instead of creating a short separate article ... we put this new info inside the main sessions article. Cheers!

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.

Add NamespacedAttributeBag usage examples
5 participants