aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggMetadata.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/classes/ElggMetadata.php')
-rw-r--r--engine/classes/ElggMetadata.php31
1 files changed, 22 insertions, 9 deletions
diff --git a/engine/classes/ElggMetadata.php b/engine/classes/ElggMetadata.php
index fe8bb4959..851397a93 100644
--- a/engine/classes/ElggMetadata.php
+++ b/engine/classes/ElggMetadata.php
@@ -4,14 +4,16 @@
* ElggMetadata
* This class describes metadata that can be attached to ElggEntities.
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage Metadata
*/
class ElggMetadata extends ElggExtender {
/**
* Construct a new site object, optionally from a given id value or row.
*
- * @param mixed $id
+ * @param mixed $id ID of metadata from DB
+ *
+ * @return void
*/
function __construct($id = null) {
$this->attributes = array();
@@ -26,7 +28,7 @@ class ElggMetadata extends ElggExtender {
if ($metadata) {
$objarray = (array) $metadata;
- foreach($objarray as $key => $value) {
+ foreach ($objarray as $key => $value) {
$this->attributes[$key] = $value;
}
$this->attributes['type'] = "metadata";
@@ -37,7 +39,8 @@ class ElggMetadata extends ElggExtender {
/**
* Class member get overloading
*
- * @param string $name
+ * @param string $name Name
+ *
* @return mixed
*/
function __get($name) {
@@ -47,8 +50,9 @@ class ElggMetadata extends ElggExtender {
/**
* Class member set overloading
*
- * @param string $name
- * @param mixed $value
+ * @param string $name Name
+ * @param mixed $value Value
+ *
* @return mixed
*/
function __set($name, $value) {
@@ -74,9 +78,12 @@ class ElggMetadata extends ElggExtender {
*/
function save() {
if ($this->id > 0) {
- return update_metadata($this->id, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
+ return update_metadata($this->id, $this->name, $this->value,
+ $this->value_type, $this->owner_guid, $this->access_id);
} else {
- $this->id = create_metadata($this->entity_guid, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
+ $this->id = create_metadata($this->entity_guid, $this->name, $this->value,
+ $this->value_type, $this->owner_guid, $this->access_id);
+
if (!$this->id) {
throw new IOException(sprintf(elgg_echo('IOException:UnableToSaveNew'), get_class()));
}
@@ -86,6 +93,8 @@ class ElggMetadata extends ElggExtender {
/**
* Delete a given metadata.
+ *
+ * @return bool
*/
function delete() {
return delete_metadata($this->id);
@@ -106,6 +115,10 @@ class ElggMetadata extends ElggExtender {
* For a given ID, return the object associated with it.
* This is used by the river functionality primarily.
* This is useful for checking access permissions etc on objects.
+ *
+ * @param int $id Metadata ID
+ *
+ * @return ElggMetadata
*/
public function getObjectFromID($id) {
return get_metadata($id);