Elgg  Version 3.0
RelationshipWhereClause.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Database\Clauses;
4 
6 
11 
15  public $ids;
16 
20  public $names;
21 
26 
30  public $object_guids;
31 
36 
41 
45  public $inverse;
46 
50  public $join_on = 'guid';
51 
55  public function prepare(QueryBuilder $qb, $table_alias = null) {
56  $alias = function ($column) use ($table_alias) {
57  return $table_alias ? "{$table_alias}.{$column}" : $column;
58  };
59 
60  $wheres = [];
61 
62  $wheres[] = parent::prepare($qb, $table_alias);
63 
64  $wheres[] = $qb->compare($alias('id'), '=', $this->ids, ELGG_VALUE_ID);
65  $wheres[] = $qb->compare($alias('relationship'), '=', $this->names, ELGG_VALUE_STRING);
66  $wheres[] = $qb->compare($alias('guid_one'), '=', $this->subject_guids, ELGG_VALUE_GUID);
67  $wheres[] = $qb->compare($alias('guid_two'), '=', $this->object_guids, ELGG_VALUE_GUID);
68  $wheres[] = $qb->between($alias('time_created'), $this->created_after, $this->created_before, ELGG_VALUE_TIMESTAMP);
69 
70  return $qb->merge($wheres);
71  }
72 
73 }
$column
Definition: add.php:10
const ELGG_VALUE_GUID
Definition: constants.php:140
Builds clauses for filtering entities by their properties in entity_relationships table...
Database abstraction query builder.
const ELGG_VALUE_ID
Definition: constants.php:141
between($x, $lower=null, $upper=null, $type=null)
Build a between clause.
compare($x, $comparison, $y=null, $type=null, $case_sensitive=null)
Build value comparison clause.
prepare(QueryBuilder $qb, $table_alias=null)
{Build an expression and/or apply it to an instance of query builder.Query builder Table aliasComposi...
const ELGG_VALUE_TIMESTAMP
Definition: constants.php:142
Builds a clause from closure or composite expression.
Definition: WhereClause.php:12
merge($parts=null, $boolean= 'AND')
Merges multiple composite expressions with a boolean.
const ELGG_VALUE_STRING
Definition: constants.php:139