From dea81fd61b6c04fda3dabc0360de312197c80db7 Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 15 Jul 2008 10:30:12 +0000 Subject: Moved temp array caching stuff to the correct functions. git-svn-id: https://code.elgg.org/elgg/trunk@1421 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'engine') 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; -- cgit v1.2.3