Allows the PlUser class to be instantiated lazily (prevents useless SQL queries).
authorVincent Zanotti <vincent.zanotti@polytechnique.org>
Sun, 15 Jun 2008 16:26:36 +0000 (18:26 +0200)
committerVincent Zanotti <vincent.zanotti@polytechnique.org>
Sun, 15 Jun 2008 16:26:36 +0000 (18:26 +0200)
Signed-off-by: Vincent Zanotti <vincent.zanotti@polytechnique.org>
classes/pluser.php

index f18bac1..070d289 100644 (file)
@@ -52,8 +52,10 @@ abstract class PlUser
     // redirection) and an optionnal array of known user properties.
     public function __construct($login, $values = array())
     {
-        list($this->user_id, $this->hruid) = $this->getLogin($login);
         $this->fillFromArray($values);
+        if (!isset($this->user_id) || !isset($this->hruid)) {
+            list($this->user_id, $this->hruid) = $this->getLogin($login);
+        }
     }