From 4aa86df958fd38f4c76f6b3d2dea2640d310b852 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Mon, 22 Nov 2021 10:07:08 +0000
Subject: [PATCH] Issue #3231040 by alexpott, Anul, longwave, bbrala, catch:
 (revert) Remove DependencySerializationTrait from JSON API exceptions

---
 .../jsonapi/src/Exception/EntityAccessDeniedHttpException.php  | 2 ++
 .../jsonapi/src/Exception/UnprocessableHttpEntityException.php | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/core/modules/jsonapi/src/Exception/EntityAccessDeniedHttpException.php b/core/modules/jsonapi/src/Exception/EntityAccessDeniedHttpException.php
index c227709900c1..74ab245e5114 100644
--- a/core/modules/jsonapi/src/Exception/EntityAccessDeniedHttpException.php
+++ b/core/modules/jsonapi/src/Exception/EntityAccessDeniedHttpException.php
@@ -5,6 +5,7 @@
 use Drupal\Core\Access\AccessResultInterface;
 use Drupal\Core\Access\AccessResultReasonInterface;
 use Drupal\Core\Cache\CacheableMetadata;
+use Drupal\Core\DependencyInjection\DependencySerializationTrait;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Http\Exception\CacheableAccessDeniedHttpException;
 use Drupal\jsonapi\JsonApiResource\ResourceIdentifier;
@@ -22,6 +23,7 @@
  */
 class EntityAccessDeniedHttpException extends CacheableAccessDeniedHttpException implements ResourceIdentifierInterface {
 
+  use DependencySerializationTrait;
   use ResourceIdentifierTrait;
 
   /**
diff --git a/core/modules/jsonapi/src/Exception/UnprocessableHttpEntityException.php b/core/modules/jsonapi/src/Exception/UnprocessableHttpEntityException.php
index eae202c553f1..b9d5a6f58389 100644
--- a/core/modules/jsonapi/src/Exception/UnprocessableHttpEntityException.php
+++ b/core/modules/jsonapi/src/Exception/UnprocessableHttpEntityException.php
@@ -3,6 +3,7 @@
 namespace Drupal\jsonapi\Exception;
 
 use Drupal\Core\Entity\EntityConstraintViolationListInterface;
+use Drupal\Core\DependencyInjection\DependencySerializationTrait;
 use Symfony\Component\HttpKernel\Exception\HttpException;
 
 /**
@@ -22,6 +23,8 @@
  */
 class UnprocessableHttpEntityException extends HttpException {
 
+  use DependencySerializationTrait;
+
   /**
    * The constraint violations associated with this exception.
    *
-- 
GitLab