32 if (!isset($this->options->$name)) {
36 return $this->options->$name;
43 $this->options->$name =
$value;
50 unset($this->options->$name);
57 return isset($this->options->$name);
76 abstract public function count();
87 abstract public function calculate($function, $property, $property_type =
null);
98 abstract public function get(
$limit =
null,
$offset =
null, $callback =
null);
108 return static::with(
$options)->execute();
121 $options = $this->options->getArrayCopy();
132 $batch_size = $this->options->batch_size;
133 $batch_inc_offset = $this->options->batch_inc_offset;
135 return new \ElggBatch([static::class,
'find'],
$options,
null, $batch_size, $batch_inc_offset);
155 public function filter(\Closure $closure) {
190 public function join($joined_table, $joined_alias =
null, $join_column =
null, $comparison =
null, $values =
null,
$type =
null, $case_sensitive =
null) {
191 $join =
new JoinClause($joined_table, $joined_alias,
function (
QueryBuilder $qb, $joined_alias) use ($join_column, $comparison, $values,
$type, $case_sensitive) {
192 return $qb->compare(
"{$joined_alias}.{$join_column}", $comparison, $values,
$type, $case_sensitive);
194 $this->options->join($join);
233 public function orderBy($expression, $direction) {
234 $this->options->orderBy(
new OrderByClause($expression, $direction));
248 foreach ($this->options->selects as $select_clause) {
249 $select_clause->prepare(
$qb, $table_alias);
252 foreach ($this->options->group_by as $group_by_clause) {
253 $group_by_clause->prepare(
$qb, $table_alias);
256 foreach ($this->options->having as $having_clause) {
257 $having_clause->prepare(
$qb, $table_alias);
260 if (!empty($this->options->order_by)) {
261 foreach ($this->options->order_by as $order_by_clause) {
262 $order_by_clause->prepare(
$qb, $table_alias);
if(! $user||! $user->canDelete()) $name
Extends QueryBuilder with GROUP BY statements.
Extends QueryBuilder with HAVING clauses.
Extends QueryBuilder with JOIN clauses.
Extends QueryBuilder with ORDER BY clauses.
Extends QueryBuilder with SELECT clauses.
Builds a clause from closure or composite expression.
Database abstraction query builder.
Abstract methods for interfacing with the database.
execute()
Apply correct execution method based on calculation, count or other criteria.
__construct(array $options=[])
Constructor.
filter(\Closure $closure)
Filter query prior to execution Callback function will receive QueryBuilder as the first argument and...
expandInto(QueryBuilder $qb, $table_alias=null)
Extend query builder with select, group_by, having and order_by clauses from $options.
orderBy($expression, $direction)
Add ORDER BY.
having($expression)
Add HAVING.
groupBy($expression)
Add GROUP BY.
select($expression)
Add SELECT.
batch($limit=null, $offset=null, $callback=null)
Fetch rows as an ElggBatch.
calculate($function, $property, $property_type=null)
Apply numeric calculation to a column.
static with(array $options=[])
Constructs a new.
static find(array $options=[])
Build and execute a new query from an array of legacy options.
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.