Property | Type | Description | |
---|---|---|---|
$config | |||
$db | |||
$entity_cache | |||
$entity_preloader | |||
$events | |||
$logger | |||
$metadata_cache | |||
$session | ElggSessio\ElggSession | ||
$subtype_table | |||
$table | string | ||
$translator |
Method | Description | |
---|---|---|
__construct ( |
Constructor | |
disableEntities ( integer $owner_guid ) : boolean | Disables all entities owned and contained by a user (or another entity) | |
enable ( integer $guid, boolean $recursive = true ) : boolean | Enable an entity. | |
exists ( integer $guid ) : boolean | Does an entity exist? | |
fetchFromSql ( string $sql, ElggBatch $batch = null ) : ElggEntit\ElggEntity[] | Return entities from an SQL query generated by elgg_get_entities. | |
get ( integer $guid, string $type = '' ) : ElggEntit\ElggEntity | stdClas\stdClass | false | Loads and returns an entity object from a guid. | |
getDates ( string $type = '', string $subtype = '', integer $container_guid, string $order_by = 'time_created' ) : array | false | Returns a list of months in which entities were updated or created. | |
getEntities ( array $options = [] ) : ElggEntity[] | integer | mixed | Returns an array of entities with optional filtering. | |
getEntitiesFromAttributes ( array $options = [] ) : ElggEntit\ElggEntity[] | mixed | Gets entities based upon attributes in secondary tables. | |
getEntityAttributeWhereSql ( array $options = [] ) : false | array | Get the join and where clauses for working with entity attributes | |
getEntityTimeWhereSql ( string $table, null | integer $time_created_upper = null, null | integer $time_created_lower = null, null | integer $time_updated_upper = null, null | integer $time_updated_lower = null ) : false | string | Returns SQL where clause for entity time limits. | |
getEntityTypeSubtypeWhereSql ( string $table, null | array $types, null | array $subtypes, null | array $pairs ) : false | string | Returns SQL where clause for type and subtype on main entity table | |
getGuidBasedWhereSql ( string $column, null | array $guids ) : false | string | Returns SQL where clause for owner and containers. | |
getRow ( integer $guid, integer $user_guid = null ) : stdClas\stdClass | false | Returns a database row from the entities table. | |
getUserForPermissionsCheck ( integer $guid ) : ElggUse\ElggUser | false | Get a user by GUID even if the entity is hidden or disabled | |
insertRow ( stdClas\stdClass $row, array $attributes = [] ) : integer | false | Adds a new row to the entity table | |
rowToElggStar ( stdClas\stdClass $row ) : ElggEntit\ElggEntity | false | Create an Elgg* object from a given entity row. | |
updateLastAction ( ElggEntit\ElggEntity $entity, integer $posted = null ) : integer | false | Update the last_action column in the entities table for $guid. | |
updateRow ( integer $guid, stdClas\stdClass $row ) : integer | false | Update entity table row |
Method | Description | |
---|---|---|
autoJoinTables ( array $options ) : array | Decorate getEntities() options in order to auto-join secondary tables where it's safe to do so. | |
getFromCache ( integer $guid ) : ElggEntity | Get an entity from the in-memory or memcache caches |
public __construct ( |
||
$config | Config | |
$db | Database | |
$entity_cache | Entity cache | |
$metadata_cache | Metadata cache | |
$subtype_table | Subtype table | |
$events | Events service | |
$session | ElggSessio\ElggSession | Session |
$translator | Translator | |
$logger | Logger |
protected autoJoinTables ( array $options ) : array | ||
$options | array | Options array in getEntities() after normalization |
return | array |
public disableEntities ( integer $owner_guid ) : boolean | ||
$owner_guid | integer | The owner GUID |
return | boolean |
public fetchFromSql ( string $sql, ElggBatch $batch = null ) : ElggEntit\ElggEntity[] | ||
$sql | string | |
$batch | ElggBatch | |
return | ElggEntit\ElggEntity[] |
public get ( integer $guid, string $type = '' ) : ElggEntit\ElggEntity | stdClas\stdClass | false | ||
$guid | integer | The GUID of the entity |
$type | string | The type of the entity. If given, even an existing entity with the given GUID will not be returned unless its type matches. |
return | ElggEntit\ElggEntity | stdClas\stdClass | false | The correct Elgg or custom object based upon entity type and subtype |
public getDates ( string $type = '', string $subtype = '', integer $container_guid, string $order_by = 'time_created' ) : array | false | ||
$type | string | The type of entity |
$subtype | string | The subtype of entity |
$container_guid | integer | The container GUID that the entities belong to |
$order_by | string | Order_by SQL order by clause |
return | array | false | Either an array months as YYYYMM, or false on failure |
public getEntities ( array $options = [] ) : ElggEntity[] | integer | mixed | ||
$options | array | Array in format: types => null|STR entity type (type IN ('type1', 'type2') Joined with subtypes by AND. See below) subtypes => null|STR entity subtype (SQL: subtype IN ('subtype1', 'subtype2)) Use ELGG_ENTITIES_NO_VALUE to match the default subtype. Use ELGG_ENTITIES_ANY_VALUE to match any subtype. type_subtype_pairs => null|ARR (array('type' => 'subtype')) array( 'object' => array('blog', 'file'), // All objects with subtype of 'blog' or 'file' 'user' => ELGG_ENTITY_ANY_VALUE, // All users irrespective of subtype ); guids => null|ARR Array of entity guids owner_guids => null|ARR Array of owner guids container_guids => null|ARR Array of container_guids order_by => null (time_created desc)|STR SQL order by clause reverse_order_by => BOOL Reverse the default order by clause limit => null (10)|INT SQL limit clause (0 means no limit) offset => null (0)|INT SQL offset clause created_time_lower => null|INT Created time lower boundary in epoch time created_time_upper => null|INT Created time upper boundary in epoch time modified_time_lower => null|INT Modified time lower boundary in epoch time modified_time_upper => null|INT Modified time upper boundary in epoch time count => true|false return a count instead of entities wheres => array() Additional where clauses to AND together joins => array() Additional joins preload_owners => bool (false) If set to true, this function will preload all the owners of the returned entities resulting in better performance if those owners need to be displayed preload_containers => bool (false) If set to true, this function will preload all the containers of the returned entities resulting in better performance if those containers need to be displayed callback => string A callback function to pass each row through distinct => bool (true) If set to false, Elgg will drop the DISTINCT clause from the MySQL query, which will improve performance in some situations. Avoid setting this option without a full understanding of the underlying SQL query Elgg creates. batch => bool (false) If set to true, an Elgg\BatchResult object will be returned instead of an array. Since 2.3 batch_inc_offset => bool (true) If "batch" is used, this tells the batch to increment the offset on each fetch. This must be set to false if you delete the batched results. batch_size => int (25) If "batch" is used, this is the number of entities/rows to pull in before requesting more. |
return | ElggEntity[] | integer | mixed | If count, int. Otherwise an array or an Elgg\BatchResult. false on errors. |
public getEntitiesFromAttributes ( array $options = [] ) : ElggEntit\ElggEntity[] | mixed | ||
$options | array | Array in format: attribute_name_value_pairs => ARR ( 'name' => 'name', 'value' => 'value', 'operand' => '=', (optional) 'case_sensitive' => false (optional) ) If multiple values are sent via an array ('value' => array('value1', 'value2') the pair's operand will be forced to "IN". attribute_name_value_pairs_operator => null|STR The operator to use for combining (name = value) OPERATOR (name = value); default is AND |
return | ElggEntit\ElggEntity[] | mixed | If count, int. If not count, array. false on errors. |
public getEntityAttributeWhereSql ( array $options = [] ) : false | array | ||
$options | array | |
return | false | array | False on fail, array('joins', 'wheres') |
public getEntityTimeWhereSql ( string $table, null | integer $time_created_upper = null, null | integer $time_created_lower = null, null | integer $time_updated_upper = null, null | integer $time_updated_lower = null ) : false | string | ||
$table | string | Entity table prefix as defined in SELECT...FROM entities $table |
$time_created_upper | null | integer | Time created upper limit |
$time_created_lower | null | integer | Time created lower limit |
$time_updated_upper | null | integer | Time updated upper limit |
$time_updated_lower | null | integer | Time updated lower limit |
return | false | string | false on fail, string on success. |
public getEntityTypeSubtypeWhereSql ( string $table, null | array $types, null | array $subtypes, null | array $pairs ) : false | string | ||
$table | string | Entity table prefix as defined in SELECT...FROM entities $table |
$types | null | array | Array of types or null if none. |
$subtypes | null | array | Array of subtypes or null if none |
$pairs | null | array | Array of pairs of types and subtypes |
return | false | string |
protected getFromCache ( integer $guid ) : ElggEntity | ||
$guid | integer | GUID |
return | ElggEntity |
public getRow ( integer $guid, integer $user_guid = null ) : stdClas\stdClass | false | ||
$guid | integer | The GUID of the object to extract |
$user_guid | integer | GUID of the user accessing the row Defaults to logged in user if null Builds an access query for a logged out user if 0 |
return | stdClas\stdClass | false |
public getUserForPermissionsCheck ( integer $guid ) : ElggUse\ElggUser | false | ||
$guid | integer | User GUID. Default is logged in user |
return | ElggUse\ElggUser | false |
public insertRow ( stdClas\stdClass $row, array $attributes = [] ) : integer | false | ||
$row | stdClas\stdClass | Entity base information |
$attributes | array | All primary and secondary table attributes Used by database mock services to allow mocking entities that were instantiated using new keyword and calling ElggEntity::save() |
return | integer | false |
public rowToElggStar ( stdClas\stdClass $row ) : ElggEntit\ElggEntity | false | ||
$row | stdClas\stdClass | The row of the entry in the entities table. |
return | ElggEntit\ElggEntity | false |
public updateLastAction ( ElggEntit\ElggEntity $entity, integer $posted = null ) : integer | false | ||
$entity | ElggEntit\ElggEntity | Entity annotation|relationship action carried out on |
$posted | integer | Timestamp of last action |
return | integer | false |
protected EntityCache,Elgg\Cache $entity_cache | ||
return |
protected EntityPreloader,Elgg $entity_preloader | ||
return |
protected MetadataCache,Elgg\Cache $metadata_cache | ||
return |
protected SubtypeTable,Elgg\Database $subtype_table | ||
return |