diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-15 10:30:12 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-15 10:30:12 +0000 |
commit | dea81fd61b6c04fda3dabc0360de312197c80db7 (patch) | |
tree | f0871d5cc7b7c84640db33ff91a35825e704c52f /engine | |
parent | ee6d78d6f6c1d6079a17ada31d6dd7bd53024bc1 (diff) | |
download | elgg-dea81fd61b6c04fda3dabc0360de312197c80db7.tar.gz elgg-dea81fd61b6c04fda3dabc0360de312197c80db7.tar.bz2 |
Moved temp array caching stuff to the correct functions.
git-svn-id: https://code.elgg.org/elgg/trunk@1421 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/entities.php | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index ad78b6f9e..ff997810c 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -111,14 +111,9 @@ } // No, so see if its in the meta data for this entity - if ((int) ($this->guid) > 0) { - $meta = $this->getMetaData($name); - if ($meta) - return $meta; - } else { - if (isset($this->temp_metadata[$name])) - return $this->temp_metadata[$name]; - } + $meta = $this->getMetaData($name); + if ($meta) + return $meta; // Can't find it, so return null return null; @@ -149,12 +144,9 @@ $this->attributes[$name] = $value; } - else if ((int) $this->guid > 0) { + else return $this->setMetaData($name, $value); - } else { - $this->temp_metadata[$name] = $value; - } - + return true; } @@ -165,7 +157,12 @@ */ public function getMetaData($name) { - $md = get_metadata_byname($this->getGUID(), $name); + if ((int) ($this->guid) > 0) { + $md = get_metadata_byname($this->getGUID(), $name); + } else { + if (isset($this->temp_metadata[$name])) + return $this->temp_metadata[$name]; + } if ($md && !is_array($md)) { return $md->value; |