33 if (!isset($this->options->$name)) {
37 $val = &$this->options->$name;
46 $this->options->$name =
$value;
53 unset($this->options->$name);
60 return isset($this->options->$name);
79 abstract public function count();
90 abstract public function calculate($function, $property, $property_type =
null);
101 abstract public function get(
$limit =
null,
$offset =
null, $callback =
null);
111 return static::with(
$options)->execute();
124 $options = $this->options->getArrayCopy();
135 $batch_size = $this->options->batch_size;
136 $batch_inc_offset = $this->options->batch_inc_offset;
138 return new \ElggBatch([static::class,
'find'],
$options,
null, $batch_size, $batch_inc_offset);
158 public function filter(\Closure $closure) {
193 public function join($joined_table, $joined_alias =
null, $join_column =
null, $comparison =
null, $values =
null,
$type =
null, $case_sensitive =
null) {
194 $join =
new JoinClause($joined_table, $joined_alias,
function (
QueryBuilder $qb, $joined_alias) use ($join_column, $comparison, $values,
$type, $case_sensitive) {
195 return $qb->compare(
"{$joined_alias}.{$join_column}", $comparison, $values,
$type, $case_sensitive);
197 $this->options->join($join);
236 public function orderBy($expression, $direction) {
237 $this->options->orderBy(
new OrderByClause($expression, $direction));
251 foreach ($this->options->selects as $select_clause) {
252 $select_clause->prepare(
$qb, $table_alias);
255 foreach ($this->options->group_by as $group_by_clause) {
256 $group_by_clause->prepare(
$qb, $table_alias);
259 foreach ($this->options->having as $having_clause) {
260 $having_clause->prepare(
$qb, $table_alias);
263 if (!empty($this->options->order_by)) {
264 foreach ($this->options->order_by as $order_by_clause) {
265 $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.