Elgg  Version master
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Elgg\Database\Repository Class Reference

Abstract methods for interfacing with the database. More...

Inheritance diagram for Elgg\Database\Repository:
Elgg\Database\Annotations Elgg\Database\Entities Elgg\Database\Metadata Elgg\Database\Relationships Elgg\Database\River

Public Member Functions

 __construct (array $options=[])
 Constructor. More...
 
 __get ($name)
 {} More...
 
 __set ($name, $value)
 {} More...
 
 __unset ($name)
 {} More...
 
 __isset ($name)
 {} More...
 
 count ()
 Count rows. More...
 
 calculate ($function, $property, $property_type=null)
 Apply numeric calculation to a column. More...
 
 get ($limit=null, $offset=null, $callback=null)
 Fetch rows. More...
 
 batch ($limit=null, $offset=null, $callback=null)
 Fetch rows as an ElggBatch. More...
 
 execute ()
 Apply correct execution method based on calculation, count or other criteria. More...
 
 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...
 
 select ($expression)
 Add SELECT. More...
 
 join ($joined_table, $joined_alias=null, $join_column=null, $comparison=null, $values=null, $type=null, $case_sensitive=null)
 Add JOIN clause Join a database table on an $x to $y comparison. More...
 
 groupBy ($expression)
 Add GROUP BY. More...
 
 having ($expression)
 Add HAVING. More...
 
 orderBy ($expression, $direction)
 Add ORDER BY. More...
 
 expandInto (QueryBuilder $qb, $table_alias=null)
 Extend query builder with select, group_by, having and order_by clauses from $options. More...
 

Static Public Member Functions

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

QueryOptions $options
 

Detailed Description

Abstract methods for interfacing with the database.

Definition at line 16 of file Repository.php.

Constructor & Destructor Documentation

Elgg\Database\Repository::__construct ( array  $options = [])

Constructor.

Parameters
array$optionsege* options

Definition at line 25 of file Repository.php.

Member Function Documentation

Elgg\Database\Repository::__get (   $name)

{}

Definition at line 32 of file Repository.php.

Elgg\Database\Repository::__isset (   $name)

{}

Definition at line 59 of file Repository.php.

Elgg\Database\Repository::__set (   $name,
  $value 
)

{}

Definition at line 45 of file Repository.php.

Elgg\Database\Repository::__unset (   $name)

{}

Definition at line 52 of file Repository.php.

Elgg\Database\Repository::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

Definition at line 123 of file Repository.php.

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

Apply numeric calculation to a column.

Parameters
string$functionCalculation, e.g. max, min, avg
string$propertyProperty name
string$property_typeProperty type
Returns
int|float
Elgg\Database\Repository::count ( )
abstract

Count rows.

Returns
int
Elgg\Database\Repository::execute ( )
abstract

Apply correct execution method based on calculation, count or other criteria.

Returns
mixed
Elgg\Database\Repository::expandInto ( QueryBuilder  $qb,
  $table_alias = null 
)

Extend query builder with select, group_by, having and order_by clauses from $options.

Parameters
QueryBuilder$qbQuery builder
string$table_aliasTable alias
Returns
void

Definition at line 250 of file Repository.php.

Elgg\Database\Repository::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.

Parameters
\Closure$closureFilter
Returns
static

Definition at line 158 of file Repository.php.

static Elgg\Database\Repository::find ( array  $options = [])
static

Build and execute a new query from an array of legacy options.

Parameters
array$optionsOptions
Returns
[]|int|mixed

Definition at line 110 of file Repository.php.

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

Fetch rows.

Parameters
int$limitNumber of rows to fetch
int$offsetIndex of the first row
callable | false$callbackCallback function to run database rows through
Returns
[]|false
Elgg\Database\Repository::groupBy (   $expression)

Add GROUP BY.

Parameters
string$expressionGroup by
Returns
static

Definition at line 209 of file Repository.php.

Elgg\Database\Repository::having (   $expression)

Add HAVING.

Parameters
string$expressionHaving
Returns
static

Definition at line 222 of file Repository.php.

Elgg\Database\Repository::join (   $joined_table,
  $joined_alias = null,
  $join_column = null,
  $comparison = null,
  $values = 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$join_columnBase 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$valuesComparison value(s)
string$typeType of the comparison value(s), e.g. ELGG_VALUE_STRING, ELGG_VALUE_INT
bool$case_sensitiveUse case sensitive comparison for string values
Returns
static

Definition at line 193 of file Repository.php.

Elgg\Database\Repository::orderBy (   $expression,
  $direction 
)

Add ORDER BY.

Parameters
string$expressionColumn/calculation
string$directionDirection
Returns
static

Definition at line 236 of file Repository.php.

Elgg\Database\Repository::select (   $expression)

Add SELECT.

Parameters
mixed$expressionSelect
Returns
static

Definition at line 171 of file Repository.php.

static Elgg\Database\Repository::with ( array  $options = [])
static

Constructs a new.

Parameters
array$optionsege* options
Returns
static

Definition at line 70 of file Repository.php.

Member Data Documentation

QueryOptions Elgg\Database\Repository::$options
protected

Definition at line 18 of file Repository.php.


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