You are here

public function PayloadViolations::resolve in Open Social 10.0.x

Resolves the value for this data producer.

Parameters

\Drupal\social_graphql\GraphQL\Payload\PayloadInterface $payload: The payload to return violations for..

Return value

null|\Drupal\social_graphql\GraphQL\ViolationInterface[] The violations for this payload or null if there are none.

File

modules/custom/social_graphql/src/Plugin/GraphQL/DataProducer/Payload/PayloadViolations.php, line 37

Class

PayloadViolations
Returns the violations in a payload.

Namespace

Drupal\social_graphql\Plugin\GraphQL\DataProducer\Payload

Code

public function resolve(PayloadInterface $payload) {

  // Explicitly turn empty arrays into NULL so that clients can perform an
  // is_null check to figure out if there are errors.
  $violations = $payload
    ->getViolations();
  return empty($violations) ? NULL : $violations;
}