aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-22 18:20:10 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-22 18:20:10 +0000
commitb36bf0e97e8dfbf2dcd07d4173392a3dcfbc2df0 (patch)
treeeadba4e265c097359389b866919201858c5ffdd5 /engine/lib/entities.php
parentcb01252489f233535e2057457cfe90920f82f96d (diff)
downloadelgg-b36bf0e97e8dfbf2dcd07d4173392a3dcfbc2df0.tar.gz
elgg-b36bf0e97e8dfbf2dcd07d4173392a3dcfbc2df0.tar.bz2
Pulling in MITRE's search core. Fo'rizzle this time. Yo.
git-svn-id: http://code.elgg.org/elgg/trunk@3572 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 373654431..7fe849421 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -63,6 +63,13 @@ abstract class ElggEntity implements
*/
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.
@@ -84,6 +91,9 @@ abstract class ElggEntity implements
if (!is_array($this->temp_annotations)) {
$this->temp_annotations = array();
}
+ if (!is_array($this->volatile)) {
+ $this->volatile = array();
+ }
$this->attributes['guid'] = "";
$this->attributes['type'] = "";
@@ -325,6 +335,35 @@ abstract class ElggEntity implements
}
}
+
+ /**
+ * 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;
+ }
+ }
+
+
+ /**
+ * Set 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;
+ }
+
+
/**
* Remove all entities associated with this entity
*