diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-04-16 11:52:37 -0400 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-04-16 11:52:37 -0400 |
commit | 309dff2bf948ab191ccb1e8d4a777e49ad498820 (patch) | |
tree | 813350181be64e239287c0bb587a3a49320a49b7 /engine/classes/ElggEntity.php | |
parent | 119ec1f1425ab77ed29c696d99c0c80df3886791 (diff) | |
parent | 2b2afd98c05139c1a5c25f1752e2bb412e26e335 (diff) | |
download | elgg-309dff2bf948ab191ccb1e8d4a777e49ad498820.tar.gz elgg-309dff2bf948ab191ccb1e8d4a777e49ad498820.tar.bz2 |
Merge branch 'master' of github.com:Elgg/Elgg
Diffstat (limited to 'engine/classes/ElggEntity.php')
-rw-r--r-- | engine/classes/ElggEntity.php | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index cfdaede71..79b8c2a4e 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -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) { @@ -717,6 +719,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 +766,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(); } } |