diff --git a/core/modules/hal/hal.services.yml b/core/modules/hal/hal.services.yml index 1560a62..7e40df0 100644 --- a/core/modules/hal/hal.services.yml +++ b/core/modules/hal/hal.services.yml @@ -26,11 +26,3 @@ services: class: Drupal\hal\Encoder\JsonEncoder tags: - { name: encoder, priority: 10, format: hal_json } - hal.exception_subscriber: - class: Drupal\hal\EventSubscriber\HalJsonExceptionSubscriber - tags: - - { name: event_subscriber } - hal.subscriber: - class: Drupal\hal\HalSubscriber - tags: - - { name: event_subscriber } diff --git a/core/modules/hal/src/EventSubscriber/HalJsonExceptionSubscriber.php b/core/modules/hal/src/EventSubscriber/HalJsonExceptionSubscriber.php deleted file mode 100644 index d8ec0be..0000000 --- a/core/modules/hal/src/EventSubscriber/HalJsonExceptionSubscriber.php +++ /dev/null @@ -1,73 +0,0 @@ -getException(); - $error = Error::decodeException($exception); - - // Display the message if the current error reporting level allows this type - // of message to be displayed, - $data = NULL; - if (error_displayable($error) && $message = $exception->getMessage()) { - $data = ['error' => sprintf('A fatal error occurred: %s', $message)]; - } - - $response = new JsonResponse($data, Response::HTTP_INTERNAL_SERVER_ERROR); - $response->headers->set('Content-type', 'application/hal+json'); - if ($exception instanceof HttpExceptionInterface) { - $response->setStatusCode($exception->getStatusCode()); - } - - $event->setResponse($response); - } - - /** - * Handles errors for this subscriber. - * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event - * The event to process. - */ - public function onException(GetResponseForExceptionEvent $event) { - $format = $event->getRequest()->getRequestFormat(); - - if ($format == 'hal_json') { - $this->onHalJson($event); - } - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() { - $events[KernelEvents::EXCEPTION][] = ['onException', -250]; - return $events; - } - -} diff --git a/core/modules/hal/src/HalSubscriber.php b/core/modules/hal/src/HalSubscriber.php deleted file mode 100644 index 93a70bb..0000000 --- a/core/modules/hal/src/HalSubscriber.php +++ /dev/null @@ -1,41 +0,0 @@ -getRequest(); - $request->setFormat('hal_json', 'application/hal+json'); - } - - /** - * Registers the methods in this class that should be listeners. - * - * @return array - * An array of event listener definitions. - */ - static function getSubscribedEvents() { - $events[KernelEvents::REQUEST][] = array('onKernelRequest', 40); - return $events; - } - -}