aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-14 00:25:29 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-14 00:25:29 +0000
commite9d468a10843ab5841ae7ad40eafba0ee0f1363e (patch)
tree994ff7904190143fdb930d2c2666deaef96563d0
parent57e0d0075d2490053ad7e879ebd6bf417c460c54 (diff)
downloadelgg-e9d468a10843ab5841ae7ad40eafba0ee0f1363e.tar.gz
elgg-e9d468a10843ab5841ae7ad40eafba0ee0f1363e.tar.bz2
making sure ElggEntity::getAnnotations() returns an array, check if temporary annotation exists before returning, and added a warning about annotating unsaved entities
git-svn-id: http://code.elgg.org/elgg/trunk@8990 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/classes/ElggEntity.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php
index cfdaede71..31885ad25 100644
--- a/engine/classes/ElggEntity.php
+++ b/engine/classes/ElggEntity.php
@@ -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();
}
}