Overview

Packages

  • ClipIt
    • clipit
      • api
    • urjc
      • backend
  • Elgg
    • Core
      • Access
      • Authentication
      • Cache
      • Caches
      • Core
      • DataMode
        • Site
      • DataModel
        • Annotations
        • Entities
        • Extender
        • File
        • Importable
        • Loggable
        • Notable
        • Object
        • User
      • DataStorage
      • Exception
      • Exceptions
        • Stub
      • FileStore
        • Disk
      • Groups
      • Helpers
      • HMAC
      • Memcache
      • Metadata
      • Navigation
      • ODD
      • Output
      • Plugins
        • Settings
      • Sessions
      • SocialModel
        • Friendable
        • Locatable
      • WebServicesAPI
      • Widgets
      • XML
      • XMLRPC
    • Exceptions
      • Stub
  • None
  • PHP

Classes

  • ElggAttributeLoader
  • ElggBatch
  • ElggData
  • Overview
  • Package
  • Class
  • Tree

Class ElggAttributeLoader

Loads ElggEntity attributes from DB or validates those passed in via constructor

Package: Elgg\Core\DataModel
Located at ElggAttributeLoader.php
Methods summary
public
# __construct( string $class, string $required_type, array $initialized_attrs )

Constructor

Constructor

Parameters

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

Throws

InvalidArgumentException
protected array
# isMissingPrimaries( stdClass $row )

Get primary attributes missing that are missing

Get primary attributes missing that are missing

Parameters

$row
stdClass
$row Database row

Returns

array
protected array
# isMissingSecondaries( stdClass $row )

Get secondary attributes that are missing

Get secondary attributes that are missing

Parameters

$row
stdClass
$row Database row

Returns

array
protected
# checkType( stdClass $row )

Check that the type is correct

Check that the type is correct

Parameters

$row
stdClass
$row Database row

Throws

InvalidClassException
public array
# getRequiredAttributes( mixed $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).

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

$row
mixed
$row a 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)

Throws

InvalidArgumentException|LogicException|IncompleteEntityException
protected array
# filterAddedColumns( array $row )

Filter out keys returned by the query which should not appear in the entity's attributes

Filter out keys returned by the query which should not appear in the entity's attributes

Parameters

$row
array
$row All columns from the query

Returns

array
Columns acceptable for the entity's attributes
Properties summary
protected static array $primary_attr_names array( 'guid', 'type', 'subtype', 'owner_guid', 'container_guid', 'site_guid', 'access_id', 'time_created', 'time_updated', 'last_action', 'enabled', )
#

names of attributes in all entities

names of attributes in all entities

protected array $secondary_attr_names array()
#

names of secondary attributes required for the entity

names of secondary attributes required for the entity

protected string $required_type
#

entity type (not class) required for fetched primaries

entity type (not class) required for fetched primaries

protected array $initialized_attributes
#
protected string $class
#

class of object being loaded

class of object being loaded

public boolean $requires_access_control true
#

should access control be considered when fetching entity?

should access control be considered when fetching entity?

public callable $primary_loader 'get_entity_as_row'
#

function used to load attributes from {prefix}entities table

function used to load attributes from {prefix}entities table

public callable $secondary_loader ''
#

function used to load attributes from secondary table

function used to load attributes from secondary table

public callable $full_loader ''
#

function used to load all necessary attributes

function used to load all necessary attributes

API documentation generated by ApiGen 2.8.0