]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
making sure ElggEntity::getAnnotations() returns an array, check if temporary annotat...
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 14 Apr 2011 00:25:29 +0000 (00:25 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 14 Apr 2011 00:25:29 +0000 (00:25 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8990 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggEntity.php

index cfdaede7114a4721903bc478b656f60c0f41a871..31885ad252a611889457cf905c55376005eb21fd 100644 (file)
@@ -717,6 +717,9 @@ abstract class ElggEntity extends ElggData implements
         *
         * @warning By default, annotations are private.
         *
+        * @warning Annotating an unsaved entity more than once with the same name
+        *          will only save the last annotation.
+        *
         * @param string $name      Annotation name
         * @param mixed  $value     Annotation value
         * @param int    $access_id Access ID
@@ -761,8 +764,10 @@ abstract class ElggEntity extends ElggData implements
                        }
 
                        return elgg_get_annotations($options);
+               } else if (isset($this->temp_annotations[$name])) {
+                       return array($this->temp_annotations[$name]);
                } else {
-                       return $this->temp_annotations[$name];
+                       return array();
                }
        }