You are here

protected function EntityQueryExclusive::applyBundleMode in GraphQL 8.3

Apply the specified bundle filtering mode to the query.

Parameters

\Drupal\Core\Entity\Query\QueryInterface $query: The entity query object.

\Drupal\Core\Entity\ContentEntityInterface $value: The parent entity object.

mixed $mode: The revision query mode.

Return value

\Drupal\Core\Entity\Query\QueryInterface The entity query object. The entity query object.

1 call to EntityQueryExclusive::applyBundleMode()
EntityQueryExclusive::getBaseQuery in modules/graphql_core/src/Plugin/GraphQL/Fields/Entity/EntityQueryExclusive.php
Create the basic entity query for the plugin's entity type.

File

modules/graphql_core/src/Plugin/GraphQL/Fields/Entity/EntityQueryExclusive.php, line 78

Class

EntityQueryExclusive
Query entities of the same type without the context's entity.

Namespace

Drupal\graphql_core\Plugin\GraphQL\Fields\Entity

Code

protected function applyBundleMode(QueryInterface $query, ContentEntityInterface $value, $mode) {
  if ($mode === 'same') {
    $type = $value
      ->getEntityType();
    if ($type
      ->hasKey('bundle')) {
      $bundle = $type
        ->getKey('bundle');
      $query
        ->condition($bundle, $value
        ->bundle());
    }
  }
  return $query;
}