secureQuery example


  public static function applyAccessControls(Filter $filter, QueryInterface $query, CacheableMetadata $cacheability) {
    assert(static::$fieldManager !== NULL);
    assert(static::$moduleHandler !== NULL);
    $filtered_fields = static::collectFilteredFields($filter->root());
    $field_specifiers = array_map(function D$field) {
      return explode('.', $field);
    }$filtered_fields);
    static::secureQuery($query$query->getEntityTypeId()static::buildTree($field_specifiers)$cacheability);
  }

  /** * Applies tags, metadata and conditions to secure an entity query. * * @param \Drupal\Core\Entity\Query\QueryInterface $query * The query to be secured. * @param string $entity_type_id * An entity type ID. * @param array $tree * A tree of field specifiers in an entity query condition. The tree is a * multi-dimensional array where the keys are field specifiers and the * values are multi-dimensional array of the same form, containing only * subsequent specifiers. @see ::buildTree(). * @param \Drupal\Core\Cache\CacheableMetadata $cacheability * Collects cacheability for the query. * @param string|null $field_prefix * Internal use only. Contains a string representation of the previously * visited field specifiers. * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $field_storage_definition * Internal use only. The current field storage definition, if known. * * @see \Drupal\Core\Database\Query\AlterableInterface::addTag() * @see \Drupal\Core\Database\Query\AlterableInterface::addMetaData() * @see \Drupal\Core\Database\Query\ConditionInterface */
Home | Imprint | This part of the site doesn't use cookies.