36 if (!isset($this->options->$name)) {
40 $val = &$this->options->$name;
49 $this->options->$name =
$value;
56 unset($this->options->$name);
63 return isset($this->options->$name);
88 return static::with(
$options)->execute();
99 $options = $this->options->getArrayCopy();
110 $batch_size = $this->options->batch_size;
111 $batch_inc_offset = $this->options->batch_inc_offset;
113 return new \ElggBatch([static::class,
'find'],
$options, null, $batch_size, $batch_inc_offset);
137 public function join($joined_table, $joined_alias = null, $x = null, $comparison = null, $y = null,
$type = null, $case_sensitive = null) {
138 $join =
new JoinClause($joined_table, $joined_alias,
function (
QueryBuilder $qb, $joined_alias) use ($x, $comparison, $y,
$type, $case_sensitive) {
139 return $qb->
compare(
"$joined_alias.$x", $comparison, $y,
$type, $case_sensitive);
141 $this->options->join($join);
167 public function orderBy($expression, $direction) {
168 $this->options->orderBy(
new OrderByClause($expression, $direction));
182 foreach ($this->options->selects as $select_clause) {
183 $select_clause->prepare($qb, $table_alias);
186 foreach ($this->options->group_by as $group_by_clause) {
187 $group_by_clause->prepare($qb, $table_alias);
190 foreach ($this->options->having as $having_clause) {
191 $having_clause->prepare($qb, $table_alias);
194 if (!empty($this->options->order_by)) {
195 foreach ($this->options->order_by as $order_by_clause) {
196 $order_by_clause->prepare($qb, $table_alias);
batch($limit=null, $offset=null, $callback=null)
{Fetch rows as an ElggBatch.Number of rows to fetch Index of the first row Callback function to run d...
static find(array $options=[])
Build and execute a new query from an array of legacy options.
if(!$user||!$user->canDelete()) $name
Extends QueryBuilder with JOIN clauses.
Extends QueryBuilder with SELECT clauses.
Database abstraction query builder.
if($pagination &&($position== 'after'||$position== 'both')) $limit
Extends QueryBuilder with GROUP BY statements.
filter(\Closure $closure)
{}
Abstract methods for interfacing with the database.
Extends QueryBuilder with HAVING clauses.
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.Name of the table (with or without d...
expandInto(QueryBuilder $qb, $table_alias=null)
Extend query builder with select, group_by, having and order_by clauses from $options.
compare($x, $comparison, $y=null, $type=null, $case_sensitive=null)
Build value comparison clause.
select($expression)
{Add SELECT.Selectstatic}
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Extends QueryBuilder with ORDER BY clauses.
Builds a clause from closure or composite expression.
groupBy($expression)
{Add GROUP BY.Group bystatic}
having($expression)
{Add HAVING.Havingstatic}
orderBy($expression, $direction)
{Add ORDER BY.Column/calculation Directionstatic}
This interface defines methods for building fluent interactions with a database repository.
__construct(array $options=[])
Constructor.
static with(array $options=[])
Constructs a new.