Implements __unset on PlUser.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 5 Jun 2010 12:45:47 +0000 (14:45 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 5 Jun 2010 12:45:47 +0000 (14:45 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/pluser.php

index 03abb2a..c4ae622 100644 (file)
@@ -192,6 +192,15 @@ abstract class PlUser
         return property_exists($this, $name) || isset($this->data[$name]);
     }
 
+    public function __unset($name)
+    {
+        if (property_exists($this, $name)) {
+            $this->$name = null;
+        } else {
+            unset($this->data[$name]);
+        }
+    }
+
     /**
      * Fills the object properties using the @p associative array; the intended
      * user case is to fill the object using SQL obtained arrays.