Elgg  Version master
AttributeWhereClause.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Database\Clauses;
4 
6 
11 
15  public $names;
16 
20  public $comparison = '=';
21 
25  public $values;
26 
31 
36 
40  public function prepare(QueryBuilder $qb, $table_alias = null) {
41  $alias = function ($column) use ($table_alias) {
42  return $table_alias ? "{$table_alias}.{$column}" : $column;
43  };
44 
45  $wheres = [];
46  $wheres[] = parent::prepare($qb, $table_alias);
47 
48  foreach ((array) $this->names as $name) {
49  $wheres[] = $qb->compare($alias($name), $this->comparison, $this->values, $this->value_type, $this->case_sensitive);
50  }
51 
52  return $qb->merge($wheres);
53  }
54 }
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
Builds quereis for matching entities by their attributes.
$column
Definition: add.php:10
Database abstraction query builder.
compare(string $x, string $comparison, $y=null, string $type=null, bool $case_sensitive=null)
Build value comparison clause.
Builds a clause from closure or composite expression.
Definition: WhereClause.php:11
merge($parts=null, $boolean= 'AND')
Merges multiple composite expressions with a boolean.
const ELGG_VALUE_STRING
Definition: constants.php:112
$qb
Definition: queue.php:12
prepare(QueryBuilder $qb, $table_alias=null)
{}