Elgg  Version 5.1
WhereClause.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Database\Clauses;
4 
7 
11 class WhereClause extends Clause {
12 
16  public $expr;
17 
23  public function __construct($expr = null) {
24  $this->expr = $expr;
25  }
26 
30  public function prepare(QueryBuilder $qb, $table_alias = null) {
31  $where = $this->expr;
32 
33  if ($this->isCallable($where)) {
34  $where = $this->call($this->expr, $qb, $table_alias);
35  }
36 
37  if ($where instanceof CompositeExpression || is_string($where)) {
38  return $where;
39  }
40  }
41 }
call($callback, QueryBuilder $qb, $table_alias=null)
Call the expression for the clause.
Definition: Clause.php:48
prepare(QueryBuilder $qb, $table_alias=null)
{}
Definition: WhereClause.php:30
Interface that allows resolving statements and/or extending query builder.
Definition: Clause.php:14
Database abstraction query builder.
isCallable($callback)
Check if a clause expression is callable.
Definition: Clause.php:35
Builds a clause from closure or composite expression.
Definition: WhereClause.php:11
__construct($expr=null)
Constructor.
Definition: WhereClause.php:23
$qb
Definition: queue.php:11