aboutsummaryrefslogtreecommitdiff
path: root/engine/classes
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-26 19:09:28 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-26 19:09:28 +0000
commit9d007274adb462063fe59a679b7135b98d97b2b2 (patch)
tree478d4d452cf7564c44f5b2104514467f4e636b80 /engine/classes
parent33924cdccbead44691dfac2caa3c882810b5003f (diff)
downloadelgg-9d007274adb462063fe59a679b7135b98d97b2b2.tar.gz
elgg-9d007274adb462063fe59a679b7135b98d97b2b2.tar.bz2
Refs #3238 #3246 anootations needed the same fixes as metadata
git-svn-id: http://code.elgg.org/elgg/trunk@8852 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes')
-rw-r--r--engine/classes/ElggAnnotation.php14
-rw-r--r--engine/classes/ElggMetadata.php4
2 files changed, 9 insertions, 9 deletions
diff --git a/engine/classes/ElggAnnotation.php b/engine/classes/ElggAnnotation.php
index 30d9c4245..78d29ee7f 100644
--- a/engine/classes/ElggAnnotation.php
+++ b/engine/classes/ElggAnnotation.php
@@ -28,26 +28,26 @@ class ElggAnnotation extends ElggExtender {
}
/**
- * Construct a new annotation, optionally from a given id value or db object.
+ * Construct a new annotation object
*
- * @param mixed $id The annotation ID
+ * @param mixed $id The annotation ID or a database row as stdClass object
*/
function __construct($id = null) {
$this->initializeAttributes();
if (!empty($id)) {
+ // Create from db row
if ($id instanceof stdClass) {
$annotation = $id;
- } else {
- $annotation = elgg_get_annotation_from_id($id);
- }
- if ($annotation) {
$objarray = (array) $annotation;
-
foreach ($objarray as $key => $value) {
$this->attributes[$key] = $value;
}
+ } else {
+ // get an ElggAnnotation object and copy its attributes
+ $annotation = elgg_get_annotation_from_id($id);
+ $this->attributes = $annotation->attributes;
}
}
}
diff --git a/engine/classes/ElggMetadata.php b/engine/classes/ElggMetadata.php
index 135c17028..ed3f8614f 100644
--- a/engine/classes/ElggMetadata.php
+++ b/engine/classes/ElggMetadata.php
@@ -16,9 +16,9 @@ class ElggMetadata extends ElggExtender {
}
/**
- * Construct a new site object, optionally from a given id value or row.
+ * Construct a metadata object
*
- * @param mixed $id ID of metadata from DB
+ * @param mixed $id ID of metadata or a database row as stdClass object
*
* @return void
*/