diff options
author | Steve Clay <steve@mrclay.org> | 2012-11-26 01:17:39 -0500 |
---|---|---|
committer | Steve Clay <steve@mrclay.org> | 2012-11-26 16:01:50 -0500 |
commit | 33c786c1b7838d38e9797b8731d4e45c9ceb1aac (patch) | |
tree | 14d0e21d0ce67939a4483ec1cf0feaccfed09780 /engine/classes/ElggPlugin.php | |
parent | 19c6da97ed0178592b9041946f3463f9008dd7ea (diff) | |
download | elgg-33c786c1b7838d38e9797b8731d4e45c9ceb1aac.tar.gz elgg-33c786c1b7838d38e9797b8731d4e45c9ceb1aac.tar.bz2 |
Fixes #4929: Optimize elgg_get_entities and add attribute loader
Diffstat (limited to 'engine/classes/ElggPlugin.php')
-rw-r--r-- | engine/classes/ElggPlugin.php | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php index 3e43c8e81..33f14ae37 100644 --- a/engine/classes/ElggPlugin.php +++ b/engine/classes/ElggPlugin.php @@ -79,64 +79,6 @@ class ElggPlugin extends ElggObject { } /** - * Overridden from ElggEntity and ElggObject::load(). Core always inits plugins with - * a query joined to the objects_entity table, so all the info is there. - * - * @param mixed $guid GUID of an ElggObject or the stdClass object from entities table - * - * @return bool - * @throws InvalidClassException - */ - protected function load($guid) { - - $expected_attributes = $this->attributes; - unset($expected_attributes['tables_split']); - unset($expected_attributes['tables_loaded']); - - // this was loaded with a full join - $needs_loaded = false; - - if ($guid instanceof stdClass) { - $row = (array) $guid; - $missing_attributes = array_diff_key($expected_attributes, $row); - if ($missing_attributes) { - $needs_loaded = true; - $guid = $row['guid']; - } else { - $this->attributes = $row; - } - } else { - $needs_loaded = true; - } - - if ($needs_loaded) { - $entity = (array) get_entity_as_row($guid); - $object = (array) get_object_entity_as_row($guid); - - if (!$entity || !$object) { - return false; - } - - $this->attributes = array_merge($this->attributes, $entity, $object); - } - - $this->attributes['tables_loaded'] = 2; - - // Check the type - if ($this->attributes['type'] != 'object') { - $msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class())); - throw new InvalidClassException($msg); - } - - // guid needs to be an int http://trac.elgg.org/ticket/4111 - $this->attributes['guid'] = (int)$this->attributes['guid']; - - cache_entity($this); - - return true; - } - - /** * Save the plugin object. Make sure required values exist. * * @see ElggObject::save() |