]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
use pkeyGet for Avatar
authorEvan Prodromou <evan@controlyourself.ca>
Thu, 2 Oct 2008 14:47:49 +0000 (10:47 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Thu, 2 Oct 2008 14:47:49 +0000 (10:47 -0400)
darcs-hash:20081002144749-5ed1f-a5503625b811f28a853712d4ddd4a76813f24bc1.gz

classes/Avatar.php
classes/Profile.php

index fc2361e2f542780c75f4f1551385f0316ee24b34..05a5ee8ef318f3fb7d0b8d30387d274c0c3e6bb2 100644 (file)
@@ -87,4 +87,8 @@ class Avatar extends Memcached_DataObject
                        return NULL;
                }
        }
+       
+       function &pkeyGet($kv) {
+               return Memcached_DataObject::pkeyGet('Avatar', $kv);
+       }
 }
index 1dffbd573f87937dad840781dfb7fb36dbdf93f3..a37821e1be5681842877b9abdaa1aeb235cef00f 100644 (file)
@@ -47,19 +47,12 @@ class Profile extends Memcached_DataObject
     ###END_AUTOCODE
 
        function getAvatar($width, $height=NULL) {
-               $avatar = DB_DataObject::factory('avatar');
-               $avatar->profile_id = $this->id;
-               $avatar->width = $width;
                if (is_null($height)) {
-                       $avatar->height = $width;
-               } else {
-                       $avatar->height = $height;
-               }
-               if ($avatar->find(true)) {
-                       return $avatar;
-               } else {
-                       return NULL;
+                       $height = $width;
                }
+               return Avatar::pkeyGet(array('profile_id' => $this->id,
+                                                                        'width' => $width,
+                                                                        'height' => $height));
        }
 
        function getOriginalAvatar() {