diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-04-14 00:35:59 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-04-14 00:35:59 +0000 |
commit | 77f5fce955ecdd66782252c63c1b81e032bd0ee6 (patch) | |
tree | 46a7052ba1281bf9a76b01b80152fe68aebf164d /engine | |
parent | 75d7daa5c644090ba640565cb2b4e3d2412d64d5 (diff) | |
download | elgg-77f5fce955ecdd66782252c63c1b81e032bd0ee6.tar.gz elgg-77f5fce955ecdd66782252c63c1b81e032bd0ee6.tar.bz2 |
fixes warnings in ElggEntity::getMetadata() (hellekin)
git-svn-id: http://code.elgg.org/elgg/trunk@8992 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/classes/ElggEntity.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index 31885ad25..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) { |