/**
* Override the load function.
* This function will ensure that all data is loaded (were possible), so
* if only part of the ElggObject is loaded, it'll load the rest.
*
* @param int $guid
* @return true|false
*/
protected function load($guid)
{
// Test to see if we have the generic stuff
if (!parent::load($guid)) {
return false;
}
// Check the type
if ($this->attributes['type'] != 'object') {
throw new InvalidClassException(sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $guid, get_class()));
}
// Load missing data
$row = get_object_entity_as_row($guid);
if ($row && !$this->isFullyLoaded()) {
$this->attributes['tables_loaded']++;
}
// If $row isn't a cached copy then increment the counter
// Now put these into the attributes array as core values
$objarray = (array) $row;
foreach ($objarray as $key => $value) {
$this->attributes[$key] = $value;
}
return true;
}