Skip to content

Commit

Permalink
minor #3735 [book] [controller] fixed the code of a session sample co…
Browse files Browse the repository at this point in the history
…de (javiereguiluz)

This PR was merged into the 2.3 branch.

Discussion
----------

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

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3+
| Fixed tickets | -

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.

Commits
-------

9da7f9b [book] [controller] fixed the code of a session sample code
  • Loading branch information
weaverryan committed Apr 2, 2014
2 parents d92545e + 9da7f9b commit ce582ec
Showing 1 changed file with 3 additions and 3 deletions.
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 comments on commit ce582ec

Please sign in to comment.