Example #1
0
 /**
  * Load the \ElggUser data from the database
  *
  * @param mixed $guid \ElggUser GUID or \stdClass database row from entity table
  *
  * @return bool
  */
 protected function load($guid)
 {
     $attr_loader = new \Elgg\AttributeLoader(get_class(), 'user', $this->attributes);
     $attr_loader->secondary_loader = 'get_user_entity_as_row';
     $attrs = $attr_loader->getRequiredAttributes($guid);
     if (!$attrs) {
         return false;
     }
     $this->attributes = $attrs;
     $this->loadAdditionalSelectValues($attr_loader->getAdditionalSelectValues());
     _elgg_services()->entityCache->set($this);
     return true;
 }
Example #2
0
 /**
  * Loads the full \ElggObject when given a guid.
  *
  * @param mixed $guid GUID of an \ElggObject or the \stdClass object from entities table
  *
  * @return bool
  * @throws InvalidClassException
  */
 protected function load($guid)
 {
     $attr_loader = new \Elgg\AttributeLoader(get_class(), 'object', $this->attributes);
     $attr_loader->requires_access_control = !$this instanceof \ElggPlugin;
     $attr_loader->secondary_loader = 'get_object_entity_as_row';
     $attrs = $attr_loader->getRequiredAttributes($guid);
     if (!$attrs) {
         return false;
     }
     $this->attributes = $attrs;
     $this->loadAdditionalSelectValues($attr_loader->getAdditionalSelectValues());
     _elgg_services()->entityCache->set($this);
     return true;
 }