Skip to content

Commit

Permalink
revert unrelated
Browse files Browse the repository at this point in the history
  • Loading branch information
dbosen committed Nov 27, 2023
1 parent 37993f4 commit aba7459
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions modules/thunder_gqls/src/Traits/ResolverHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,14 @@ protected function createResolverBuilder(): void {
* Name of the filed.
* @param \Drupal\graphql\GraphQL\Resolver\ResolverInterface|null $entity
* Entity to get the field property.
* @param bool $multiValue
* Whether the field is returns multiple values.
*
* @return \Drupal\graphql\GraphQL\Resolver\Composite
* @return \Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerProxy
* The field data producer.
*/
public function fromEntityReference(string $field, ResolverInterface $entity = NULL, bool $multiValue = TRUE) {
return $this->builder->compose(
$this->builder->produce('entity_reference')
->map('field', $this->builder->fromValue($field))
->map('entity', $entity ?: $this->builder->fromParent()),
$this->builder->callback(function ($parent) use ($multiValue) {
if ($multiValue) {
return $parent;
}
if (!empty($parent[0])) {
return $parent[0];
}
return NULL;
})
);
public function fromEntityReference(string $field, ResolverInterface $entity = NULL) {
return $this->builder->produce('entity_reference')
->map('field', $this->builder->fromValue($field))
->map('entity', $entity ?: $this->builder->fromParent());
}

/**
Expand Down

0 comments on commit aba7459

Please sign in to comment.