PHP Class Elgg\AttributeLoader

Exibir arquivo Open project: elgg/elgg

Public Properties

Property Type Description
$full_loader function used to load all necessary attributes
$primary_loader function used to load attributes from {prefix}entities table
$requires_access_control should access control be considered when fetching entity?
$secondary_loader function used to load attributes from secondary table

Protected Properties

Property Type Description
$additional_select_values retrieved values that are not attributes
$class class of object being loaded
$initialized_attributes array
$integer_attr_names names of attributes in all entities that should be stored as integer values
$null_attr_names names of attributes in all entities that should be stored as null if empty
$primary_attr_names names of attributes in all entities
$required_type entity type (not class) required for fetched primaries
$secondary_attr_names names of secondary attributes required for the entity

Public Methods

Method Description
__construct ( string $class, string $required_type, array $initialized_attrs ) Constructor
getAdditionalSelectValues ( ) : array Get values selected from the database that are not attributes
getRequiredAttributes ( mixed $row ) : array Get all required attributes for the entity, validating any that are passed in. Returns empty array if can't be loaded (Check $failure_reason).

Protected Methods

Method Description
checkType ( stdClass $row ) : void Check that the type is correct
filterAddedColumns ( array $row ) : array Filter non-attribute keys into $this->additional_select_values
isMissingPrimaries ( stdClass $row ) : array Get primary attributes missing that are missing
isMissingSecondaries ( stdClass $row ) : array Get secondary attributes that are missing

Method Details

__construct() public method

Constructor
public __construct ( string $class, string $required_type, array $initialized_attrs )
$class string class of object being loaded
$required_type string entity type this is being used to populate
$initialized_attrs array attributes after initializeAttributes() has been run

checkType() protected method

Check that the type is correct
protected checkType ( stdClass $row ) : void
$row stdClass Database row
return void

filterAddedColumns() protected method

Filter non-attribute keys into $this->additional_select_values
protected filterAddedColumns ( array $row ) : array
$row array All columns from the query
return array Columns acceptable for the entity's attributes

getAdditionalSelectValues() public method

Get values selected from the database that are not attributes
public getAdditionalSelectValues ( ) : array
return array

getRequiredAttributes() public method

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.
public getRequiredAttributes ( mixed $row ) : array
$row mixed a row loaded from DB (array or \stdClass) or a GUID
return array will be empty if failed to load all attributes (access control or entity doesn't exist)

isMissingPrimaries() protected method

Get primary attributes missing that are missing
protected isMissingPrimaries ( stdClass $row ) : array
$row stdClass Database row
return array

isMissingSecondaries() protected method

Get secondary attributes that are missing
protected isMissingSecondaries ( stdClass $row ) : array
$row stdClass Database row
return array

Property Details

$additional_select_values protected_oe property

retrieved values that are not attributes
protected $additional_select_values

$class protected_oe property

class of object being loaded
protected $class

$full_loader public_oe property

function used to load all necessary attributes
public $full_loader

$initialized_attributes protected_oe property

protected array $initialized_attributes
return array

$integer_attr_names protected_oe static_oe property

names of attributes in all entities that should be stored as integer values
protected static $integer_attr_names

$null_attr_names protected_oe static_oe property

names of attributes in all entities that should be stored as null if empty
protected static $null_attr_names

$primary_attr_names protected_oe static_oe property

names of attributes in all entities
protected static $primary_attr_names

$primary_loader public_oe property

function used to load attributes from {prefix}entities table
public $primary_loader

$required_type protected_oe property

entity type (not class) required for fetched primaries
protected $required_type

$requires_access_control public_oe property

should access control be considered when fetching entity?
public $requires_access_control

$secondary_attr_names protected_oe property

names of secondary attributes required for the entity
protected $secondary_attr_names

$secondary_loader public_oe property

function used to load attributes from secondary table
public $secondary_loader