You are here

class EntityCrudOutputWrapper in GraphQL 8.3

Hierarchy

Expanded class hierarchy of EntityCrudOutputWrapper

6 files declare their use of EntityCrudOutputWrapper
CreateEntityBase.php in modules/graphql_core/src/Plugin/GraphQL/Mutations/Entity/CreateEntityBase.php
DeleteEntityBase.php in modules/graphql_core/src/Plugin/GraphQL/Mutations/Entity/DeleteEntityBase.php
EntityCrudOutputEntity.php in modules/graphql_core/src/Plugin/GraphQL/Fields/Mutations/EntityCrudOutputEntity.php
EntityCrudOutputErrors.php in modules/graphql_core/src/Plugin/GraphQL/Fields/Mutations/EntityCrudOutputErrors.php
EntityCrudOutputViolations.php in modules/graphql_core/src/Plugin/GraphQL/Fields/Mutations/EntityCrudOutputViolations.php

... See full list

File

modules/graphql_core/src/GraphQL/EntityCrudOutputWrapper.php, line 8

Namespace

Drupal\graphql_core\GraphQL
View source
class EntityCrudOutputWrapper {

  /**
   * The create entity.
   *
   * @var \Drupal\Core\Entity\EntityInterface|null
   */
  protected $entity;

  /**
   * The constraint validation list.
   *
   * @var \Symfony\Component\Validator\ConstraintViolationListInterface|null
   */
  protected $violations;

  /**
   * An array of error messages.
   *
   * @var array|null
   */
  protected $errors;

  /**
   * CreateEntityOutputWrapper constructor.
   *
   * @param \Drupal\Core\Entity\EntityInterface|null $entity
   *   The entity object that has been created or NULL if creation failed.
   * @param \Symfony\Component\Validator\ConstraintViolationListInterface|null $violations
   *   The validation errors that occurred during creation or NULL if validation
   *   succeeded.
   * @param array|null $errors
   *   An array of non validation error messages. Can be used to provide
   *   additional error messages e.g. for access restrictions.
   */
  public function __construct(EntityInterface $entity = NULL, ConstraintViolationListInterface $violations = NULL, array $errors = NULL) {
    $this->entity = $entity;
    $this->violations = $violations;
    $this->errors = $errors;
  }

  /**
   * Returns the entity that was created.
   *
   * @return \Drupal\Core\Entity\EntityInterface|null
   *   The created entity object or NULL if creation failed.
   */
  public function getEntity() {
    return $this->entity;
  }

  /**
   * Returns the constraint violations.
   *
   * @return \Symfony\Component\Validator\ConstraintViolationListInterface|null
   *   The constraint validations or NULL if validation passed.
   */
  public function getViolations() {
    return $this->violations;
  }

  /**
   * Returns a list of error messages that occurred during entity creation.
   *
   * @return array|null
   *   An array of error messages as plain strings.
   */
  public function getErrors() {
    return $this->errors;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityCrudOutputWrapper::$entity protected property The create entity.
EntityCrudOutputWrapper::$errors protected property An array of error messages.
EntityCrudOutputWrapper::$violations protected property The constraint validation list.
EntityCrudOutputWrapper::getEntity public function Returns the entity that was created.
EntityCrudOutputWrapper::getErrors public function Returns a list of error messages that occurred during entity creation.
EntityCrudOutputWrapper::getViolations public function Returns the constraint violations.
EntityCrudOutputWrapper::__construct public function CreateEntityOutputWrapper constructor.