Elgg  Version 1.9
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Elgg_AttributeLoader Class Reference

Public Member Functions

 __construct ($class, $required_type, array $initialized_attrs)
 Constructor. More...
 
 getAdditionalSelectValues ()
 Get values selected from the database that are not attributes. More...
 
 getRequiredAttributes ($row)
 Get all required attributes for the entity, validating any that are passed in. More...
 

Public Attributes

 $requires_access_control = true
 
 $primary_loader = 'get_entity_as_row'
 
 $secondary_loader = ''
 
 $full_loader = ''
 

Protected Member Functions

 isMissingPrimaries ($row)
 Get primary attributes missing that are missing. More...
 
 isMissingSecondaries ($row)
 Get secondary attributes that are missing. More...
 
 checkType ($row)
 Check that the type is correct. More...
 
 filterAddedColumns ($row)
 Filter non-attribute keys into $this->additional_select_values. More...
 

Protected Attributes

 $secondary_attr_names = array()
 
 $required_type
 
 $initialized_attributes
 
 $class
 
 $additional_select_values = array()
 

Static Protected Attributes

static $primary_attr_names
 
static $integer_attr_names
 
static $null_attr_names
 

Detailed Description

Definition at line 11 of file AttributeLoader.php.

Constructor & Destructor Documentation

Elgg_AttributeLoader::__construct (   $class,
  $required_type,
array  $initialized_attrs 
)

Constructor.

Parameters
string$classclass of object being loaded
string$required_typeentity type this is being used to populate
array$initialized_attrsattributes after initializeAttributes() has been run
Exceptions
InvalidArgumentException

Definition at line 113 of file AttributeLoader.php.

Member Function Documentation

Elgg_AttributeLoader::checkType (   $row)
protected

Check that the type is correct.

Parameters
stdClass$rowDatabase row
Returns
void
Exceptions
InvalidClassException

Definition at line 156 of file AttributeLoader.php.

Elgg_AttributeLoader::filterAddedColumns (   $row)
protected

Filter non-attribute keys into $this->additional_select_values.

Parameters
array$rowAll columns from the query
Returns
array Columns acceptable for the entity's attributes

Definition at line 269 of file AttributeLoader.php.

Elgg_AttributeLoader::getAdditionalSelectValues ( )

Get values selected from the database that are not attributes.

Returns
array

Definition at line 168 of file AttributeLoader.php.

Elgg_AttributeLoader::getRequiredAttributes (   $row)

Get all required attributes for the entity, validating any that are passed in.

Returns empty array if can't be loaded (Check $failure_reason).

This function splits loading between "primary" attributes (those in {prefix}entities table) and "secondary" attributes (e.g. those in {prefix}objects_entity), but can load all at once if a combined loader is available.

Parameters
mixed$rowa row loaded from DB (array or stdClass) or a GUID
Returns
array will be empty if failed to load all attributes (access control or entity doesn't exist)
Exceptions
InvalidArgumentException|LogicException|IncompleteEntityException

Definition at line 185 of file AttributeLoader.php.

Elgg_AttributeLoader::isMissingPrimaries (   $row)
protected

Get primary attributes missing that are missing.

Parameters
stdClass$rowDatabase row
Returns
array

Definition at line 135 of file AttributeLoader.php.

Elgg_AttributeLoader::isMissingSecondaries (   $row)
protected

Get secondary attributes that are missing.

Parameters
stdClass$rowDatabase row
Returns
array

Definition at line 145 of file AttributeLoader.php.

Member Data Documentation

Elgg_AttributeLoader::$additional_select_values = array()
protected

Definition at line 103 of file AttributeLoader.php.

Elgg_AttributeLoader::$class
protected

Definition at line 78 of file AttributeLoader.php.

Elgg_AttributeLoader::$full_loader = ''

Definition at line 98 of file AttributeLoader.php.

Elgg_AttributeLoader::$initialized_attributes
protected

Definition at line 73 of file AttributeLoader.php.

Elgg_AttributeLoader::$integer_attr_names
staticprotected
Initial value:
= array(
'guid',
'owner_guid',
'container_guid',
'site_guid',
'access_id',
'time_created',
'time_updated',
'last_action',
'prev_last_action',
'last_login',
'prev_last_login'
)

Definition at line 35 of file AttributeLoader.php.

Elgg_AttributeLoader::$null_attr_names
staticprotected
Initial value:
= array(
'name',
'title',
'description',
'url',
)

Definition at line 53 of file AttributeLoader.php.

Elgg_AttributeLoader::$primary_attr_names
staticprotected
Initial value:
= array(
'guid',
'type',
'subtype',
'owner_guid',
'container_guid',
'site_guid',
'access_id',
'time_created',
'time_updated',
'last_action',
'enabled',
)

Definition at line 18 of file AttributeLoader.php.

Elgg_AttributeLoader::$primary_loader = 'get_entity_as_row'

Definition at line 88 of file AttributeLoader.php.

Elgg_AttributeLoader::$required_type
protected

Definition at line 68 of file AttributeLoader.php.

Elgg_AttributeLoader::$requires_access_control = true

Definition at line 83 of file AttributeLoader.php.

Elgg_AttributeLoader::$secondary_attr_names = array()
protected

Definition at line 63 of file AttributeLoader.php.

Elgg_AttributeLoader::$secondary_loader = ''

Definition at line 93 of file AttributeLoader.php.


The documentation for this class was generated from the following file: