PHP Class Elgg\AttributeLoader

Afficher le fichier Open project: elgg/elgg

Méthodes publiques

Свойство 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

Свойство 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

Méthodes publiques

Méthode 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).

Méthodes protégées

Méthode 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 méthode

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 méthode

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

filterAddedColumns() protected méthode

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

getAdditionalSelectValues() public méthode

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

getRequiredAttributes() public méthode

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
Résultat array will be empty if failed to load all attributes (access control or entity doesn't exist)

isMissingPrimaries() protected méthode

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

isMissingSecondaries() protected méthode

Get secondary attributes that are missing
protected isMissingSecondaries ( stdClass $row ) : array
$row stdClass Database row
Résultat 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
Résultat 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