]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
We never accept a user without a Profile
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 14 Oct 2013 23:00:27 +0000 (01:00 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 14 Oct 2013 23:00:27 +0000 (01:00 +0200)
classes/User.php

index e9f1d1b2cfc0499caafe8e4688084cbf2154bccd..ca3281107e65ea0fc0e9f5144bd39fe75c2f8f54 100644 (file)
@@ -120,16 +120,18 @@ class User extends Managed_DataObject
         );
     }
 
-    protected $_profile = -1;
+    protected $_profile = null;
 
     /**
      * @return Profile
+     *
+     * @throws UserNoProfileException if user has no profile
      */
-    function getProfile()
+    public function getProfile()
     {
-        if (is_int($this->_profile) && $this->_profile == -1) { // invalid but distinct from null
+        if (!($this->_profile instanceof Profile)) {
             $this->_profile = Profile::getKV('id', $this->id);
-            if (empty($this->_profile)) {
+            if (!($this->_profile instanceof Profile)) {
                 throw new UserNoProfileException($this);
             }
         }