QueryException example

/** * {@inheritdoc} */
  public function get(EntityTypeInterface $entity_type$conjunction) {
    return new Query($entity_type$conjunction$this->namespaces, $this->keyValueFactory);
  }

  /** * {@inheritdoc} */
  public function getAggregate(EntityTypeInterface $entity_type$conjunction) {
    throw new QueryException('Aggregation over key-value entity storage is not supported');
  }

}

  protected function prepare() {
    if ($this->allRevisions) {
      if (!$base_table = $this->entityType->getRevisionTable()) {
        throw new QueryException("No revision table for " . $this->entityTypeId . ", invalid query.");
      }
    }
    else {
      if (!$base_table = $this->entityType->getBaseTable()) {
        throw new QueryException("No base table for " . $this->entityTypeId . ", invalid query.");
      }
    }
    $simple_query = TRUE;
    if ($this->entityType->getDataTable()) {
      $simple_query = FALSE;
    }
    
case 'STARTS_WITH':
          return strpos($value$condition['value']) === 0;

        case 'CONTAINS':
          return str_contains($value$condition['value']);

        case 'ENDS_WITH':
          return substr($value, -strlen($condition['value'])) === (string) $condition['value'];

        default:
          throw new QueryException('Invalid condition operator.');
      }
    }
    return FALSE;
  }

}
/** * {@inheritdoc} */
  public function get(EntityTypeInterface $entity_type$conjunction) {
    return new Query($entity_type$conjunction$this->configFactory, $this->keyValueFactory, $this->namespaces);
  }

  /** * {@inheritdoc} */
  public function getAggregate(EntityTypeInterface $entity_type$conjunction) {
    throw new QueryException('Aggregation over configuration entities is not supported');
  }

  /** * Gets the key value store used to store fast lookups. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type. * * @return \Drupal\Core\KeyValueStore\KeyValueStoreInterface * The key value store used to store fast lookups. */
  
$entity_type_id = $target_definition->getEntityTypeId();
          }
          $entity_type = $this->entityTypeManager->getActiveDefinition($entity_type_id);
          $field_storage_definitions = $this->entityFieldManager->getActiveFieldStorageDefinitions($entity_type_id);
          // Add the new entity base table using the table and sql column.           $base_table = $this->addNextBaseTable($entity_type$table$sql_column$field_storage);
          $propertyDefinitions = [];
          $key++;
          $index_prefix .= "$next_index_prefix.";
        }
        else {
          throw new QueryException("Invalid specifier '$relationship_specifier'");
        }
      }
    }
    return "$table.$sql_column";
  }

  /** * {@inheritdoc} */
  public function isFieldCaseSensitive($field_name) {
    if (isset($this->caseSensitiveFields[$field_name])) {
      
Home | Imprint | This part of the site doesn't use cookies.