@@ -223,6 +223,7 @@ public function setFlashes($values)
223
223
}
224
224
225
225
$ this ->attributes ['_flash ' ] = $ values ;
226
+ $ this ->oldFlashes = array ();
226
227
}
227
228
228
229
public function getFlash ($ name , $ default = null )
@@ -242,27 +243,42 @@ public function setFlash($name, $value)
242
243
243
244
public function hasFlash ($ name )
244
245
{
246
+ if (false === $ this ->started ) {
247
+ $ this ->start ();
248
+ }
249
+
245
250
return array_key_exists ($ name , $ this ->attributes ['_flash ' ]);
246
251
}
247
252
248
253
public function removeFlash ($ name )
249
254
{
255
+ if (false === $ this ->started ) {
256
+ $ this ->start ();
257
+ }
258
+
250
259
unset($ this ->attributes ['_flash ' ][$ name ]);
251
260
}
252
261
253
262
public function clearFlashes ()
254
263
{
264
+ if (false === $ this ->started ) {
265
+ $ this ->start ();
266
+ }
267
+
255
268
$ this ->attributes ['_flash ' ] = array ();
269
+ $ this ->oldFlashes = array ();
256
270
}
257
271
258
272
public function save ()
259
273
{
260
- if (true === $ this ->started ) {
261
- if (isset ($ this ->attributes ['_flash ' ])) {
262
- $ this ->attributes ['_flash ' ] = array_diff_key ($ this ->attributes ['_flash ' ], $ this ->oldFlashes );
263
- }
264
- $ this ->storage ->write ('_symfony2 ' , $ this ->attributes );
274
+ if (false === $ this ->started ) {
275
+ $ this ->start ();
276
+ }
277
+
278
+ if (isset ($ this ->attributes ['_flash ' ])) {
279
+ $ this ->attributes ['_flash ' ] = array_diff_key ($ this ->attributes ['_flash ' ], $ this ->oldFlashes );
265
280
}
281
+ $ this ->storage ->write ('_symfony2 ' , $ this ->attributes );
266
282
}
267
283
268
284
public function __destruct ()
0 commit comments