deprecated method stopPropagation()

Created on 31 October 2023, about 1 year ago

Hello Drupal Community,

We are currently encountering an issue while upgrading from Drupal 9 to Drupal 10. It appears that some functions have been deprecated, such as "stopPropagation()". Below is the code snippet in question:

<?php
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class AccountRedirectSubscriber implements EventSubscriberInterface {

  public function glossaryRedirect(RequestEvent $event) {
    $node = \Drupal::routeMatch()->getParameter('node');
    if ($node && $node instanceof NodeInterface && $node->isPublished() && $node->bundle() == 'glossary' && \Drupal::routeMatch()->getRouteName() == 'entity.node.canonical') {
      if ($node->field_parent_ref->target_id) {
        $response = new RedirectResponse(Url::fromRoute('entity.node.canonical', ['node' => $node->field_parent_ref->entity->id()])->toString(), 301, []);
        $event->setResponse($response);
        // $event->stopPropagation();
        return;
      }
    }
  }


  public static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = ['glossaryRedirect'];
    return $events;
  }

}
?>

We would greatly appreciate your guidance and expertise in addressing this matter. Thank you for your assistance.

Best regards,
Rajeev

💬 Support request
Status

Fixed

Component

Other

Created by

🇮🇳India rajeevcoder

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024