Elgg
Version 1.11
|
Public Member Functions | |
__construct () | |
Constructor. More... | |
getRow ($guid) | |
Returns a database row from the entities table. More... | |
rowToElggStar ($row) | |
Create an Elgg* object from a given entity row. More... | |
get ($guid, $type= '') | |
Loads and returns an entity object from a guid. More... | |
exists ($guid) | |
Does an entity exist? More... | |
enable ($guid, $recursive=true) | |
Enable an entity. More... | |
getEntities (array $options=array()) | |
Returns an array of entities with optional filtering. More... | |
fetchFromSql ($sql,\ElggBatch $batch=null) | |
Return entities from an SQL query generated by elgg_get_entities. More... | |
getEntityTypeSubtypeWhereSql ($table, $types, $subtypes, $pairs) | |
Returns SQL where clause for type and subtype on main entity table. More... | |
getGuidBasedWhereSql ($column, $guids) | |
Returns SQL where clause for owner and containers. More... | |
getEntityTimeWhereSql ($table, $time_created_upper=null, $time_created_lower=null, $time_updated_upper=null, $time_updated_lower=null) | |
Returns SQL where clause for entity time limits. More... | |
getEntitiesFromAttributes (array $options=array()) | |
Gets entities based upon attributes in secondary tables. More... | |
getEntityAttributeWhereSql (array $options=array()) | |
Get the join and where clauses for working with entity attributes. More... | |
getDates ($type= '', $subtype= '', $container_guid=0, $site_guid=0, $order_by= 'time_created') | |
Returns a list of months in which entities were updated or created. More... | |
updateLastAction ($guid, $posted=null) | |
Update the last_action column in the entities table for $guid. More... | |
Protected Member Functions | |
autoJoinTables (array $options) | |
Decorate getEntities() options in order to auto-join secondary tables where it's safe to do so. More... | |
Definition at line 15 of file EntityTable.php.
Elgg\Database\EntityTable::__construct | ( | ) |
Constructor.
Definition at line 26 of file EntityTable.php.
|
protected |
Decorate getEntities() options in order to auto-join secondary tables where it's safe to do so.
array | $options | Options array in getEntities() after normalization |
Definition at line 523 of file EntityTable.php.
Elgg\Database\EntityTable::enable | ( | $guid, | |
$recursive = true |
|||
) |
Enable an entity.
int | $guid | GUID of entity to enable |
bool | $recursive | Recursively enable all entities disabled with the entity? |
Definition at line 212 of file EntityTable.php.
Elgg\Database\EntityTable::exists | ( | $guid | ) |
Does an entity exist?
This function checks for the existence of an entity independent of access permissions. It is useful for situations when a user cannot access an entity and it must be determined whether entity has been deleted or the access level has changed.
int | $guid | The GUID of the entity |
Definition at line 190 of file EntityTable.php.
Elgg\Database\EntityTable::fetchFromSql | ( | $sql, | |
\ElggBatch | $batch = null |
||
) |
Return entities from an SQL query generated by elgg_get_entities.
string | $sql | |
\ElggBatch | $batch |
private
Definition at line 579 of file EntityTable.php.
Elgg\Database\EntityTable::get | ( | $guid, | |
$type = '' |
|||
) |
Loads and returns an entity object from a guid.
int | $guid | The GUID of the entity |
string | $type | The type of the entity. If given, even an existing entity with the given GUID will not be returned unless its type matches. |
Definition at line 149 of file EntityTable.php.
Elgg\Database\EntityTable::getDates | ( | $type = '' , |
|
$subtype = '' , |
|||
$container_guid = 0 , |
|||
$site_guid = 0 , |
|||
$order_by = 'time_created' |
|||
) |
Returns a list of months in which entities were updated or created.
Use this to generate a list of archives by month for when entities were added or updated.
string | $type | The type of entity |
string | $subtype | The subtype of entity |
int | $container_guid | The container GUID that the entities belong to |
int | $site_guid | The site GUID |
string | $order_by | Order_by SQL order by clause |
Definition at line 1119 of file EntityTable.php.
Elgg\Database\EntityTable::getEntities | ( | array | $options = array() | ) |
Returns an array of entities with optional filtering.
Entities are the basic unit of storage in Elgg. This function provides the simplest way to get an array of entities. There are many options available that can be passed to filter what sorts of entities are returned.
To output formatted strings of entities, use elgg_list_entities() and its cousins.
Plural arguments can be written as singular if only specifying a single element. ('type' => 'object' vs 'types' => array('object')).
array | $options | 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 for no subtype. type_subtype_pairs => null|ARR (array('type' => 'subtype')) (type = '$type' AND subtype = '$subtype') pairs |
guids => null|ARR Array of entity guids
owner_guids => null|ARR Array of owner guids
container_guids => null|ARR Array of container_guids
site_guids => null (current_site)|ARR Array of site_guid
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.
Definition at line 306 of file EntityTable.php.
Elgg\Database\EntityTable::getEntitiesFromAttributes | ( | array | $options = array() | ) |
Gets entities based upon attributes in secondary tables.
Also accepts all options available to elgg_get_entities(), elgg_get_entities_from_metadata(), and elgg_get_entities_from_relationship().
array | $options | 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 |
InvalidArgumentException |
Definition at line 959 of file EntityTable.php.
Elgg\Database\EntityTable::getEntityAttributeWhereSql | ( | array | $options = array() | ) |
Get the join and where clauses for working with entity attributes.
InvalidArgumentException |
Definition at line 1002 of file EntityTable.php.
Elgg\Database\EntityTable::getEntityTimeWhereSql | ( | $table, | |
$time_created_upper = null , |
|||
$time_created_lower = null , |
|||
$time_updated_upper = null , |
|||
$time_updated_lower = null |
|||
) |
Returns SQL where clause for entity time limits.
string | $table | Entity table prefix as defined in SELECT...FROM entities $table |
null | int | $time_created_upper | Time created upper limit |
null | int | $time_created_lower | Time created lower limit |
null | int | $time_updated_upper | Time updated upper limit |
null | int | $time_updated_lower | Time updated lower limit |
Definition at line 898 of file EntityTable.php.
Elgg\Database\EntityTable::getEntityTypeSubtypeWhereSql | ( | $table, | |
$types, | |||
$subtypes, | |||
$pairs | |||
) |
Returns SQL where clause for type and subtype on main entity table.
string | $table | Entity table prefix as defined in SELECT...FROM entities $table |
null | array | $types | Array of types or null if none. |
null | array | $subtypes | Array of subtypes or null if none |
null | array | $pairs | Array of pairs of types and subtypes |
Definition at line 682 of file EntityTable.php.
Elgg\Database\EntityTable::getGuidBasedWhereSql | ( | $column, | |
$guids | |||
) |
Returns SQL where clause for owner and containers.
string | $column | Column name the guids should be checked against. Usually best to provide in table.column format. |
null | array | $guids | Array of GUIDs. |
Definition at line 850 of file EntityTable.php.
Elgg\Database\EntityTable::getRow | ( | $guid | ) |
Returns a database row from the entities table.
Use get_entity() to return the fully loaded entity.
int | $guid | The GUID of the object to extract |
Definition at line 45 of file EntityTable.php.
Elgg\Database\EntityTable::rowToElggStar | ( | $row | ) |
Create an Elgg* object from a given entity row.
Handles loading all tables into the correct class.
\stdClass | $row | The row of the entry in the entities table. |
Definition at line 73 of file EntityTable.php.
Elgg\Database\EntityTable::updateLastAction | ( | $guid, | |
$posted = null |
|||
) |
Update the last_action column in the entities table for $guid.
int | $guid | Entity annotation|relationship action carried out on |
int | $posted | Timestamp of last action |
Definition at line 1216 of file EntityTable.php.