File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -149,14 +149,16 @@ controllers if you type-hint an argument with
149
149
150
150
public function someMethod()
151
151
{
152
+ $session = $this->requestStack->getSession();
153
+
152
154
// stores an attribute in the session for later reuse
153
- $this->requestStack->getSession() ->set('attribute-name', 'attribute-value');
155
+ $session ->set('attribute-name', 'attribute-value');
154
156
155
157
// gets an attribute by name
156
- $foo = $this->requestStack->getSession() ->get('foo');
158
+ $foo = $session ->get('foo');
157
159
158
160
// the second argument is the value returned when the attribute doesn't exist
159
- $filters = $this->requestStack->getSession() ->get('filters', []);
161
+ $filters = $session ->get('filters', []);
160
162
161
163
// ...
162
164
}
You can’t perform that action at this time.
0 commit comments