]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
fixes warnings in ElggEntity::getMetadata() (hellekin)
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 14 Apr 2011 00:35:59 +0000 (00:35 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 14 Apr 2011 00:35:59 +0000 (00:35 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8992 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggEntity.php

index 31885ad252a611889457cf905c55376005eb21fd..79b8c2a4e3564d25f1cffedb0ab7ca02e05d7afe 100644 (file)
@@ -246,18 +246,20 @@ abstract class ElggEntity extends ElggData implements
         * @return mixed The value, or NULL if not found.
         */
        public function getMetaData($name) {
-               if ((int) ($this->guid) > 0) {
-                       $md = elgg_get_metadata(array(
-                               'guid' => $this->getGUID(),
-                               'metadata_name' => $name,
-                               'limit' => 0,
-                       ));
-               } else {
+               if ((int) ($this->guid) == 0) {
                        if (isset($this->temp_metadata[$name])) {
                                return $this->temp_metadata[$name];
+                       } else {
+                               return null;
                        }
                }
 
+               $md = elgg_get_metadata(array(
+                       'guid' => $this->getGUID(),
+                       'metadata_name' => $name,
+                       'limit' => 0,
+               ));
+
                if ($md && !is_array($md)) {
                        return $md->value;
                } elseif (count($md) == 1) {