diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-09 19:33:33 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-09 19:33:33 +0000 |
commit | f9aa70c258578d907cdeb1e9d5b26fffca5bede6 (patch) | |
tree | 35596f164c262cc6d2f653ff16f7fa650118f186 /engine/lib/entities.php | |
parent | b62012bf3da994298ad52a4ccec06e814bcc5a79 (diff) | |
download | elgg-f9aa70c258578d907cdeb1e9d5b26fffca5bede6.tar.gz elgg-f9aa70c258578d907cdeb1e9d5b26fffca5bede6.tar.bz2 |
Pulled in Justin's search changes from github.
git-svn-id: http://code.elgg.org/elgg/trunk@3520 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r-- | engine/lib/entities.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index b72eb6ff0..55a675154 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -63,6 +63,13 @@ */ protected $temp_annotations; + + /** + * Volatile data structure for this object, allows for storage of data + * in-memory that isn't sync'd back to the metadata table. + */ + protected $volatile; + /** * Initialise the attributes array. * This is vital to distinguish between metadata and base parameters. @@ -79,6 +86,7 @@ if (!is_array($this->attributes)) $this->attributes = array(); if (!is_array($this->temp_metadata)) $this->temp_metadata = array(); if (!is_array($this->temp_annotations)) $this->temp_annotations = array(); + if (!is_array($this->volatile)) $this->volatile = array(); $this->attributes['guid'] = ""; $this->attributes['type'] = ""; @@ -174,6 +182,31 @@ return true; } + + /** + * Get a piece of volatile (non-persisted) data on this entity + */ + public function getVolatileData($name) { + if (!is_array($this->volatile)) $this->volatile = array(); + + if (array_key_exists($name, $this->volatile)) { + return $this->volatile[$name]; + } else { + return NULL; + } + } + + + /** + * Get a piece of volatile (non-persisted) data on this entity + */ + public function setVolatileData($name, $value) { + if (!is_array($this->volatile)) $this->volatile = array(); + + $this->volatile[$name] = $value; + } + + /** * Get a given piece of metadata. * @@ -686,6 +719,7 @@ { // Create the array if necessary - all subclasses should test before creating if (!is_array($this->attributes)) $this->attributes = array(); + if (!is_array($this->volatile)) $this->volatile = array(); // Now put these into the attributes array as core values $objarray = (array) $row; |