@@ 30-48 (lines=19) @@ | ||
27 | * } |
|
28 | * ) |
|
29 | */ |
|
30 | class EntityRevisions extends EntityQuery { |
|
31 | ||
32 | /** |
|
33 | * {@inheritdoc} |
|
34 | */ |
|
35 | public function getBaseQuery($value, array $args, ResolveInfo $info) { |
|
36 | if ($value instanceof EntityInterface) { |
|
37 | $query = parent::getBaseQuery($value, $args, $info); |
|
38 | ||
39 | // Add the entity id as a filter condition. |
|
40 | $key = $value->getEntityType()->getKey('id'); |
|
41 | $query->condition($key, $value->id()); |
|
42 | ||
43 | // Mark the query as a revision query. |
|
44 | return $this->applyRevisionsMode($query, 'all'); |
|
45 | } |
|
46 | } |
|
47 | ||
48 | } |
|
49 |
@@ 33-51 (lines=19) @@ | ||
30 | * deriver = "Drupal\graphql_core\Plugin\Deriver\Fields\EntityReferenceReverseDeriver" |
|
31 | * ) |
|
32 | */ |
|
33 | class EntityReferenceReverse extends EntityQuery { |
|
34 | ||
35 | /** |
|
36 | * {@inheritdoc} |
|
37 | */ |
|
38 | public function getBaseQuery($value, array $args, ResolveInfo $info) { |
|
39 | if ($value instanceof EntityInterface) { |
|
40 | $query = parent::getBaseQuery($value, $args, $info); |
|
41 | ||
42 | // Add the target field condition to the query. |
|
43 | $definition = $this->getPluginDefinition(); |
|
44 | $field = $definition['field']; |
|
45 | $query->condition($field, $value->id()); |
|
46 | ||
47 | return $query; |
|
48 | } |
|
49 | } |
|
50 | ||
51 | } |
|
52 |