aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggObject.php
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2013-02-13 01:25:07 +0100
committerSem <sembrestels@riseup.net>2013-02-13 01:25:07 +0100
commit5aff5b3913fbb6226d8fb3162453c58888fba38d (patch)
tree2bf8fe649d8c9d09a3be03154c4c669bccfbc54c /engine/classes/ElggObject.php
parent3ed289b03fa3d851fd7fffbc0441ebc9b5e98310 (diff)
parent8d3a7ab1755829c6e070a038d6b33e326de8fc8f (diff)
downloadelgg-5aff5b3913fbb6226d8fb3162453c58888fba38d.tar.gz
elgg-5aff5b3913fbb6226d8fb3162453c58888fba38d.tar.bz2
Merge tag '1.8.13' of git://github.com/Elgg/Elgg
Elgg 1.8.13 release
Diffstat (limited to 'engine/classes/ElggObject.php')
-rw-r--r--engine/classes/ElggObject.php39
1 files changed, 10 insertions, 29 deletions
diff --git a/engine/classes/ElggObject.php b/engine/classes/ElggObject.php
index fa6296c8c..6263f84f6 100644
--- a/engine/classes/ElggObject.php
+++ b/engine/classes/ElggObject.php
@@ -99,37 +99,18 @@ class ElggObject extends ElggEntity {
* @throws InvalidClassException
*/
protected function load($guid) {
- // Load data from entity table if needed
- if (!parent::load($guid)) {
- return false;
- }
+ $attr_loader = new ElggAttributeLoader(get_class(), 'object', $this->attributes);
+ $attr_loader->requires_access_control = !($this instanceof ElggPlugin);
+ $attr_loader->secondary_loader = 'get_object_entity_as_row';
- // Only work with GUID from here
- if ($guid instanceof stdClass) {
- $guid = $guid->guid;
- }
-
- // Check the type
- if ($this->attributes['type'] != 'object') {
- $msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));
- throw new InvalidClassException($msg);
- }
-
- // Load missing data
- $row = get_object_entity_as_row($guid);
- if (($row) && (!$this->isFullyLoaded())) {
- // If $row isn't a cached copy then increment the counter
- $this->attributes['tables_loaded']++;
- }
-
- // Now put these into the attributes array as core values
- $objarray = (array) $row;
- foreach ($objarray as $key => $value) {
- $this->attributes[$key] = $value;
+ $attrs = $attr_loader->getRequiredAttributes($guid);
+ if (!$attrs) {
+ return false;
}
- // guid needs to be an int http://trac.elgg.org/ticket/4111
- $this->attributes['guid'] = (int)$this->attributes['guid'];
+ $this->attributes = $attrs;
+ $this->attributes['tables_loaded'] = 2;
+ cache_entity($this);
return true;
}
@@ -149,7 +130,7 @@ class ElggObject extends ElggEntity {
// Save ElggObject-specific attributes
return create_object_entity($this->get('guid'), $this->get('title'),
- $this->get('description'), $this->get('container_guid'));
+ $this->get('description'));
}
/**