Explorar o código

[HttpFoundation] Added removeFlash & clearFlashes methods to the Session

Jordi Boggiano %!s(int64=14) %!d(string=hai) anos
pai
achega
584769dd16
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  1. 10 0
      src/Symfony/Component/HttpFoundation/Session.php

+ 10 - 0
src/Symfony/Component/HttpFoundation/Session.php

@@ -236,6 +236,16 @@ class Session implements \Serializable
         return array_key_exists($name, $this->attributes['_flash']);
     }
 
+    public function removeFlash($name)
+    {
+        unset($this->attributes['_flash'][$name]);
+    }
+
+    public function clearFlashes()
+    {
+        $this->attributes['_flash'] = array();
+    }
+
     public function save()
     {
         if (true === $this->started) {