trait QueryConditionTrait

Same name in other branches
  1. 9 core/lib/Drupal/Core/Database/Query/QueryConditionTrait.php \Drupal\Core\Database\Query\QueryConditionTrait
  2. 8.9.x core/lib/Drupal/Core/Database/Query/QueryConditionTrait.php \Drupal\Core\Database\Query\QueryConditionTrait
  3. 11.x core/lib/Drupal/Core/Database/Query/QueryConditionTrait.php \Drupal\Core\Database\Query\QueryConditionTrait

Provides an implementation of ConditionInterface.

Hierarchy

See also

\Drupal\Core\Database\Query\ConditionInterface

File

core/lib/Drupal/Core/Database/Query/QueryConditionTrait.php, line 12

Namespace

Drupal\Core\Database\Query
View source
trait QueryConditionTrait {
    
    /**
     * The condition object for this query.
     *
     * Condition handling is handled via composition.
     *
     * @var \Drupal\Core\Database\Query\Condition
     */
    protected $condition;
    
    /**
     * {@inheritdoc}
     */
    public function condition($field, $value = NULL, $operator = '=') {
        $this->condition
            ->condition($field, $value, $operator);
        return $this;
    }
    
    /**
     * {@inheritdoc}
     */
    public function isNull($field) {
        $this->condition
            ->isNull($field);
        return $this;
    }
    
    /**
     * {@inheritdoc}
     */
    public function isNotNull($field) {
        $this->condition
            ->isNotNull($field);
        return $this;
    }
    
    /**
     * {@inheritdoc}
     */
    public function exists(SelectInterface $select) {
        $this->condition
            ->exists($select);
        return $this;
    }
    
    /**
     * {@inheritdoc}
     */
    public function notExists(SelectInterface $select) {
        $this->condition
            ->notExists($select);
        return $this;
    }
    
    /**
     * {@inheritdoc}
     */
    public function alwaysFalse() {
        $this->condition
            ->alwaysFalse();
        return $this;
    }
    
    /**
     * {@inheritdoc}
     */
    public function &conditions() {
        return $this->condition
            ->conditions();
    }
    
    /**
     * {@inheritdoc}
     */
    public function arguments() {
        return $this->condition
            ->arguments();
    }
    
    /**
     * {@inheritdoc}
     */
    public function where($snippet, $args = []) {
        $this->condition
            ->where($snippet, $args);
        return $this;
    }
    
    /**
     * {@inheritdoc}
     */
    public function compile(Connection $connection, PlaceholderInterface $queryPlaceholder) {
        $this->condition
            ->compile($connection, $queryPlaceholder);
    }
    
    /**
     * {@inheritdoc}
     */
    public function compiled() {
        return $this->condition
            ->compiled();
    }
    
    /**
     * {@inheritdoc}
     */
    public function conditionGroupFactory($conjunction = 'AND') {
        return $this->connection
            ->condition($conjunction);
    }
    
    /**
     * {@inheritdoc}
     */
    public function andConditionGroup() {
        return $this->conditionGroupFactory('AND');
    }
    
    /**
     * {@inheritdoc}
     */
    public function orConditionGroup() {
        return $this->conditionGroupFactory('OR');
    }

}

Members

Title Sort descending Modifiers Object type Summary Overrides
QueryConditionTrait::$condition protected property The condition object for this query.
QueryConditionTrait::alwaysFalse public function
QueryConditionTrait::andConditionGroup public function
QueryConditionTrait::arguments public function 1
QueryConditionTrait::compile public function 1
QueryConditionTrait::compiled public function 1
QueryConditionTrait::condition public function
QueryConditionTrait::conditionGroupFactory public function
QueryConditionTrait::conditions public function
QueryConditionTrait::exists public function
QueryConditionTrait::isNotNull public function
QueryConditionTrait::isNull public function
QueryConditionTrait::notExists public function
QueryConditionTrait::orConditionGroup public function
QueryConditionTrait::where public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.