Elgg  Version master
WhereClause.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Database\Clauses;
4 
5 use Closure;
8 
12 class WhereClause extends Clause {
13 
17  public $expr;
18 
24  public function __construct($expr = null) {
25  $this->expr = $expr;
26  }
27 
31  public function prepare(QueryBuilder $qb, $table_alias = null) {
32  $where = $this->expr;
33 
34  if ($this->isCallable($where)) {
35  $where = $this->call($this->expr, $qb, $table_alias);
36  }
37 
38  if ($where instanceof CompositeExpression || is_string($where)) {
39  return $where;
40  }
41  }
42 }
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:31
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:12
__construct($expr=null)
Constructor.
Definition: WhereClause.php:24
$qb
Definition: queue.php:12