aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-07 17:10:00 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-07 17:10:00 +0000
commit5db2402d1eb38e012081509be292bcd1fcef164d (patch)
tree38ac683d65db430b36ec312e6322bea6d8f6bcbf /engine/lib/entities.php
parent0925c90d74a2e5132a8b21c9c099b2153cee734a (diff)
downloadelgg-5db2402d1eb38e012081509be292bcd1fcef164d.tar.gz
elgg-5db2402d1eb38e012081509be292bcd1fcef164d.tar.bz2
Centralised set and get magic functions to the tlc. Added isset and unset magic methods.
Report any problems! git-svn-id: https://code.elgg.org/elgg/trunk@1776 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 0985298f7..bf66a0132 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -185,6 +185,44 @@
}
/**
+ * Class member get overloading
+ *
+ * @param string $name
+ * @return mixed
+ */
+ function __get($name) { return $this->get($name); }
+
+ /**
+ * Class member set overloading
+ *
+ * @param string $name
+ * @param mixed $value
+ * @return mixed
+ */
+ function __set($name, $value) { return $this->set($name, $value); }
+
+ /**
+ * Supporting isset.
+ *
+ * @param string $name The name of the attribute or metadata.
+ * @return bool
+ */
+ function __isset($name) { if ($this->$name!="") return true; else return false; }
+
+ /**
+ * Supporting unsetting of magic attributes.
+ *
+ * @param string $name The name of the attribute or metadata.
+ */
+ function __unset($name)
+ {
+ if (array_key_exists($name, $this->attributes))
+ $this->attributes[$name] = "";
+ else
+ $this->clearMetaData($name);
+ }
+
+ /**
* Set a piece of metadata.
*
* @param string $name