QueryConditionTrait.php in Drupal 8
File
core/lib/Drupal/Core/Database/Query/QueryConditionTrait.php
View source
<?php
namespace Drupal\Core\Database\Query;
use Drupal\Core\Database\Connection;
trait QueryConditionTrait {
protected $condition;
public function condition($field, $value = NULL, $operator = '=') {
$this->condition
->condition($field, $value, $operator);
return $this;
}
public function isNull($field) {
$this->condition
->isNull($field);
return $this;
}
public function isNotNull($field) {
$this->condition
->isNotNull($field);
return $this;
}
public function exists(SelectInterface $select) {
$this->condition
->exists($select);
return $this;
}
public function notExists(SelectInterface $select) {
$this->condition
->notExists($select);
return $this;
}
public function alwaysFalse() {
$this->condition
->alwaysFalse();
return $this;
}
public function &conditions() {
return $this->condition
->conditions();
}
public function arguments() {
return $this->condition
->arguments();
}
public function where($snippet, $args = []) {
$this->condition
->where($snippet, $args);
return $this;
}
public function compile(Connection $connection, PlaceholderInterface $queryPlaceholder) {
$this->condition
->compile($connection, $queryPlaceholder);
}
public function compiled() {
return $this->condition
->compiled();
}
public function conditionGroupFactory($conjunction = 'AND') {
return $this->connection
->condition($conjunction);
}
public function andConditionGroup() {
return $this
->conditionGroupFactory('AND');
}
public function orConditionGroup() {
return $this
->conditionGroupFactory('OR');
}
}