aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/objects.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/objects.php')
-rw-r--r--engine/lib/objects.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/engine/lib/objects.php b/engine/lib/objects.php
index 62039ff38..f939b0ce5 100644
--- a/engine/lib/objects.php
+++ b/engine/lib/objects.php
@@ -21,10 +21,8 @@
function row_to_elggobject($row) {
if (empty($row))
return $row;
- $object = new ElggObject();
- foreach(get_object_vars($row) as $property => $value)
- $object->$property = $value;
- return $object;
+
+ return new ElggObject($row);
}
/**
@@ -367,8 +365,13 @@
$this->attributes = array();
- if (!empty($id)) {
- if ($object = get_object($id)) {
+ if (!empty($id)) {
+ if ($id instanceof stdClass)
+ $object = $id; // Create from db row
+ else
+ $object = get_object($id);
+
+ if ($object) {
$objarray = (array) $object;
foreach($objarray as $key => $value) {
$this->attributes[$key] = $value;