Abstract methods for interfacing with the database.
More...
|
| __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 | with (array $options=[]) |
| Constructs a new. More...
|
|
static | find (array $options=[]) |
| Build and execute a new query from an array of legacy options. More...
|
|
Abstract methods for interfacing with the database.
Definition at line 16 of file Repository.php.
Elgg\Database\Repository::__construct |
( |
array |
$options = [] | ) |
|
Constructor.
- Parameters
-
array | $options | ege* options |
Definition at line 25 of file Repository.php.
Elgg\Database\Repository::__get |
( |
|
$name | ) |
|
Elgg\Database\Repository::__isset |
( |
|
$name | ) |
|
Elgg\Database\Repository::__set |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
Elgg\Database\Repository::__unset |
( |
|
$name | ) |
|
Elgg\Database\Repository::batch |
( |
|
$limit = null , |
|
|
|
$offset = null , |
|
|
|
$callback = null |
|
) |
| |
Fetch rows as an ElggBatch.
- Parameters
-
int | $limit | Number of rows to fetch |
int | $offset | Index of the first row |
callable | false | $callback | Callback 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 | $function | Calculation, e.g. max, min, avg |
string | $property | Property name |
string | $property_type | Property type |
- Returns
- int|float
Elgg\Database\Repository::count |
( |
| ) |
|
|
abstract |
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
-
- 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
-
- 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
-
- 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 | $limit | Number of rows to fetch |
int | $offset | Index of the first row |
callable | false | $callback | Callback function to run database rows through |
- Returns
- []|false
Elgg\Database\Repository::groupBy |
( |
|
$expression | ) |
|
Add GROUP BY.
- Parameters
-
string | $expression | Group by |
- Returns
- static
Definition at line 209 of file Repository.php.
Elgg\Database\Repository::having |
( |
|
$expression | ) |
|
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_table | Name of the table (with or without dbprefix) |
string | $joined_alias | Alias of the joined table If not set, the alias will be assigned automatically |
string | $join_column | Base column, e.g. 'n_table.entity_guid' This value is NOT a query parameter and will not be sanitized |
string | $comparison | Comparison operator, e.g. '=', 'not like' etc |
mixed | $values | Comparison value(s) |
string | $type | Type of the comparison value(s), e.g. ELGG_VALUE_STRING, ELGG_VALUE_INT |
bool | $case_sensitive | Use 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 | $expression | Column/calculation |
string | $direction | Direction |
- Returns
- static
Definition at line 236 of file Repository.php.
Elgg\Database\Repository::select |
( |
|
$expression | ) |
|
static Elgg\Database\Repository::with |
( |
array |
$options = [] | ) |
|
|
static |
Constructs a new.
- Parameters
-
array | $options | ege* options |
- Returns
- static
Definition at line 70 of file Repository.php.
The documentation for this class was generated from the following file: