getConjunction example


  public function compile($conditionContainer) {
    // If this is not the top level condition group then the sql query is     // added to the $conditionContainer object by this function itself. The     // SQL query object is only necessary to pass to Query::addField() so it     // can join tables as necessary. On the other hand, conditions need to be     // added to the $conditionContainer object to keep grouping.     $sql_query = ($conditionContainer instanceof SelectInterface) ? $conditionContainer : $this->sqlQuery;
    $tables = new Tables($sql_query);
    foreach ($this->conditions as $condition) {
      if ($condition['field'] instanceof ConditionAggregateInterface) {
        $sql_condition = $sql_query->getConnection()->condition($condition['field']->getConjunction());
        // Add the SQL query to the object before calling this method again.         $condition['field']->sqlQuery = $sql_query;
        $condition['field']->compile($sql_condition);
        $sql_query->condition($sql_condition);
      }
      else {
        $type = ((strtoupper($this->conjunction) == 'OR') || ($condition['operator'] == 'IS NULL')) ? 'LEFT' : 'INNER';
        $field = $tables->addField($condition['field']$type$condition['langcode']);
        $condition_class = QueryBase::getClass($this->namespaces, 'Condition');
        $condition_class::translateCondition($condition$sql_query$tables->isFieldCaseSensitive($condition['field']));
        $function = $condition['function'];
        

  protected function loadRecords() {
    $prefix = $this->entityType->getConfigPrefix() . '.';
    $prefix_length = strlen($prefix);

    // Search the conditions for restrictions on configuration object names.     $filter_by_names = [];
    $has_added_restrictions = FALSE;
    $id_condition = NULL;
    $id_key = $this->entityType->getKey('id');
    if ($this->condition->getConjunction() == 'AND') {
      $lookup_keys = $this->entityType->getLookupKeys();
      $conditions = $this->condition->conditions();
      foreach ($conditions as $condition_key => $condition) {
        $operator = $condition['operator'] ?: (is_array($condition['value']) ? 'IN' : '=');
        if (is_string($condition['field']) && ($operator == 'IN' || $operator == '=')) {
          // Special case ID lookups.           if ($condition['field'] == $id_key) {
            $has_added_restrictions = TRUE;
            $ids = (array) $condition['value'];
            $filter_by_names[] = array_map(static function D$id) use ($prefix) {
              return $prefix . $id;
            },
public function compile($conditionContainer) {

    // If this is not the top level condition group then the sql query is     // added to the $conditionContainer object by this function itself. The     // SQL query object is only necessary to pass to Query::addField() so it     // can join tables as necessary. On the other hand, conditions need to be     // added to the $conditionContainer object to keep grouping.     $sql_query = $conditionContainer instanceof SelectInterface ? $conditionContainer : $this->sqlQuery;
    $tables = $this->query->getTables($sql_query);
    foreach ($this->conditions as $condition) {
      if ($condition['field'] instanceof ConditionInterface) {
        $sql_condition = $sql_query->getConnection()->condition($condition['field']->getConjunction());
        // Add the SQL query to the object before calling this method again.         $condition['field']->sqlQuery = $sql_query;
        $condition['field']->nestedInsideOrCondition = $this->nestedInsideOrCondition || strtoupper($this->conjunction) === 'OR';
        $condition['field']->compile($sql_condition);
        $conditionContainer->condition($sql_condition);
      }
      else {
        $type = $this->nestedInsideOrCondition || strtoupper($this->conjunction) === 'OR' || $condition['operator'] === 'IS NULL' ? 'LEFT' : 'INNER';
        $field = $tables->addField($condition['field']$type$condition['langcode']);
        // If the field is trying to query on %delta for a single value field         // then the only supported delta is 0. No other value than 0 makes
Home | Imprint | This part of the site doesn't use cookies.