8000 [book] [controller] fixed the code of a session sample code by javiereguiluz · Pull Request #3735 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[book] [controller] fixed the code of a session sample code #3735

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
Apr 2, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
[book] [controller] fixed the code of a session sample code
This code was updated in the past to use the $request controller
injection and the resulting code was a bit confusing. When you get
the attribute set by another controller, it's better to use a
different attribute name, to make it clear that it wasn't set at
this controller.
  • Loading branch information
javiereguiluz committed Mar 29, 2014
commit 9da7f9bb09046315d749dc9a9f6d98ce83f6b4e4
6 changes: 3 additions & 3 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,10 @@ from any controller::
// store an attribute for reuse during a later user request
$session->set('foo', 'bar');

// in another controller for another request
$foo = $session->get('foo');
// get the attribute set by another controller in another request
$foobar = $session->get('foobar');

// use a default value if the key doesn't exist
// use a default value if the attribute doesn't exist
$filters = $session->get('filters', array());
}

Expand Down
0