Elgg  Version 3.0
Public Member Functions | Protected Member Functions | List of all members
Elgg\Database\Annotations Class Reference

Annotation repository contains methods for fetching annotations from database or performing calculations on entity properties. More...

Inheritance diagram for Elgg\Database\Annotations:
Elgg\Database\Repository Elgg\Database\QueryExecuting

Public Member Functions

 count ()
 {Count rows.
Returns
int
} More...
 
 calculate ($function, $property, $property_type=null)
 Performs a mathematical calculation on metadata or metadata entity's properties. More...
 
 get ($limit=null, $offset=null, $callback=null)
 Fetch metadata. More...
 
 execute ()
 Execute the query resolving calculation, count and/or batch options. More...
 
- Public Member Functions inherited from Elgg\Database\Repository
 __construct (array $options=[])
 Constructor. More...
 
 __get ($name)
 {} More...
 
 __set ($name, $value)
 {} More...
 
 __unset ($name)
 {} More...
 
 __isset ($name)
 {} More...
 
 batch ($limit=null, $offset=null, $callback=null)
 {Fetch rows as an ElggBatch.
Parameters
int$limitNumber of rows to fetch
int$offsetIndex of the first row
callable | false$callbackCallback function to run database rows through
Returns
ElggBatch
} More...
 
 filter (\Closure $closure)
 {} More...
 
 select ($expression)
 {Add SELECT.
Parameters
mixed$expressionSelect
Returns
static
} More...
 
 join ($joined_table, $joined_alias=null, $x=null, $comparison=null, $y=null, $type=null, $case_sensitive=null)
 {Add JOIN clause Join a database table on an $x to $y comparison.
Parameters
string$joined_tableName of the table (with or without dbprefix)
string$joined_aliasAlias of the joined table If not set, the alias will be assigned automatically
string$xBase column, e.g. 'n_table.entity_guid' This value is NOT a query parameter and will not be sanitized
string$comparisonComparison operator, e.g. '=', 'not like' etc
mixed$yComparison value(s)
string$typeType of the comparison value(s), e.g. ELGG_VALUE_STRING, ELGG_VALUE_INT
bool$case_sensitiveUse case senstivie comparison for string values
Returns
static
} More...
 
 groupBy ($expression)
 {Add GROUP BY.
Parameters
string$expressionGroup by
Returns
static
} More...
 
 having ($expression)
 {Add HAVING.
Parameters
string$expressionHaving
Returns
static
} More...
 
 orderBy ($expression, $direction)
 {Add ORDER BY.
Parameters
string$expressionColumn/calculation
string$directionDirection
Returns
static
} More...
 
 expandInto (QueryBuilder $qb, $table_alias=null)
 Extend query builder with select, group_by, having and order_by clauses from $options. More...
 
- Public Member Functions inherited from Elgg\Database\QueryExecuting
 filter (Closure $closure)
 Filter query prior to execution Callback function will receive QueryBuilder as the first argument and table alias as a second Callback function can either mutate the instance of the QueryBuilder or return a composition expression that will be appended to AND where statements. More...
 

Protected Member Functions

 buildQuery (QueryBuilder $qb)
 Build a database query. More...
 
 buildEntityWhereClause (QueryBuilder $qb)
 Process entity attribute wheres Joins entities table on entity guid in annotations table and applies where clauses. More...
 
 buildPairedAnnotationClause (QueryBuilder $qb, $clauses, $boolean= 'AND')
 Process annotation name value pairs Applies where clauses to the selected annotation table. More...
 
 buildPairedMetadataClause (QueryBuilder $qb, $clauses, $boolean= 'AND')
 Process metadata name value pairs Joins metadata table on entity_guid in the annotations table and applies where clauses. More...
 
 buildPairedPrivateSettingsClause (QueryBuilder $qb, $clauses, $boolean= 'AND')
 Process private settings name value pairs Joins private settings table on entity_guid in the annotations table and applies where clauses. More...
 
 buildPairedRelationshipClause (QueryBuilder $qb, $clauses, $boolean= 'AND')
 Process relationship name value pairs Joins relationship table on entity_guid in the annotations table and applies where clauses. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Elgg\Database\Repository
static with (array $options=[])
 Constructs a new. More...
 
static find (array $options=[])
 Build and execute a new query from an array of legacy options. More...
 
- Protected Attributes inherited from Elgg\Database\Repository
 $options
 

Detailed Description

Annotation repository contains methods for fetching annotations from database or performing calculations on entity properties.

API IN FLUX Do not access the methods directly, use elgg_get_annotations() instead

Definition at line 25 of file Annotations.php.

Member Function Documentation

Elgg\Database\Annotations::buildEntityWhereClause ( QueryBuilder  $qb)
protected

Process entity attribute wheres Joins entities table on entity guid in annotations table and applies where clauses.

Parameters
QueryBuilder$qbQuery builder
Returns
Closure|CompositeExpression|mixed|null|string

Definition at line 234 of file Annotations.php.

Elgg\Database\Annotations::buildPairedAnnotationClause ( QueryBuilder  $qb,
  $clauses,
  $boolean = 'AND' 
)
protected

Process annotation name value pairs Applies where clauses to the selected annotation table.

Parameters
QueryBuilder$qbQuery builder
AnnotationWhereClause[]$clauses Where clauses
string$booleanMerge boolean
Returns
CompositeExpression|string

Definition at line 249 of file Annotations.php.

Elgg\Database\Annotations::buildPairedMetadataClause ( QueryBuilder  $qb,
  $clauses,
  $boolean = 'AND' 
)
protected

Process metadata name value pairs Joins metadata table on entity_guid in the annotations table and applies where clauses.

Parameters
QueryBuilder$qbQuery builder
MetadataWhereClause[]$clauses Where clauses
string$booleanMerge boolean
Returns
CompositeExpression|string

Definition at line 274 of file Annotations.php.

Elgg\Database\Annotations::buildPairedPrivateSettingsClause ( QueryBuilder  $qb,
  $clauses,
  $boolean = 'AND' 
)
protected

Process private settings name value pairs Joins private settings table on entity_guid in the annotations table and applies where clauses.

Parameters
QueryBuilder$qbQuery builder
PrivateSettingWhereClause[]$clauses Where clauses
string$booleanMerge boolean
Returns
CompositeExpression|string

Definition at line 299 of file Annotations.php.

Elgg\Database\Annotations::buildPairedRelationshipClause ( QueryBuilder  $qb,
  $clauses,
  $boolean = 'AND' 
)
protected

Process relationship name value pairs Joins relationship table on entity_guid in the annotations table and applies where clauses.

Parameters
QueryBuilder$qbQuery builder
RelationshipWhereClause[]$clauses Where clauses
string$booleanMerge boolean
Returns
CompositeExpression|string

Definition at line 324 of file Annotations.php.

Elgg\Database\Annotations::buildQuery ( QueryBuilder  $qb)
protected

Build a database query.

Parameters
QueryBuilder$qb
Returns
QueryBuilder

Definition at line 198 of file Annotations.php.

Elgg\Database\Annotations::calculate (   $function,
  $property,
  $property_type = null 
)

Performs a mathematical calculation on metadata or metadata entity's properties.

Parameters
string$functionValid numeric function
string$propertyProperty name
string$property_type'attribute'|'metadata'|'annotation'|'private_setting'
Returns
int|float
Exceptions
InvalidParameterException

Implements Elgg\Database\QueryExecuting.

Definition at line 57 of file Annotations.php.

Elgg\Database\Annotations::count ( )

{Count rows.

Returns
int
}

Implements Elgg\Database\QueryExecuting.

Definition at line 30 of file Annotations.php.

Elgg\Database\Annotations::execute ( )

Execute the query resolving calculation, count and/or batch options.

Returns
array|[]|ElggAnnotation[]|false|int
Exceptions

Implements Elgg\Database\QueryExecuting.

Definition at line 162 of file Annotations.php.

Elgg\Database\Annotations::get (   $limit = null,
  $offset = null,
  $callback = null 
)

Fetch metadata.

Parameters
int$limitLimit
int$offsetOffset
callable$callbackCustom callback
Returns
ElggAnnotation[]

Implements Elgg\Database\QueryExecuting.

Definition at line 118 of file Annotations.php.


The documentation for this class was generated from the following file: