Problem/Motivation

We are using service providers to change the class of event_dispatcher to TraceableEventDispatcher and replacing and arg to 'http_kernel.basic' to use 'tracer.debug.controller_resolver'. Instead we can use service decorators, which are just yaml definitions and a more standard way of doing things in Symfony.

See https://symfony.com/doc/current/service_container/service_decoration.html

Steps to reproduce

Proposed resolution

Remove the logic in the service provider and replace with decorators in tracer.services.yml

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#3 3350037-3.patch1.08 KBakshaydalvi212

Issue fork tracer-3350037

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kim.pepper created an issue. See original summary.

akshaydalvi212’s picture

Assigned: Unassigned » akshaydalvi212

I will work on updating the service.yml for creating new service decorator.

akshaydalvi212’s picture

Assigned: akshaydalvi212 » Unassigned
Status: Active » Needs review
StatusFileSize
new1.08 KB

I tried to create the service decorator and replace it in the service.yml file.
Providing the #3 patch file.
kindly review.

anybody’s picture

I think this might also lower the risk for bugs and incompatibilities in the future?

lussoluca’s picture

Status: Needs review » Needs work

The actual patch fails with this error:

Fatal error: Uncaught TypeError: Drupal\Core\Config\ConfigFactory::__construct(): Argument #2 ($event_dispatcher) must be of type Symfony\Contracts\EventDispatcher\EventDispatcherInterface, Drupal\tracer\Controller\TraceableControllerResolver given, called in /var/www/html/web/core/lib/Drupal/Component/DependencyInje
ction/Container.php on line 259 and defined in /var/www/html/web/core/lib/Drupal/Core/Config/ConfigFactory.php:72 
el7cosmos’s picture

el7cosmos’s picture

Status: Needs work » Needs review

I created an MR to decorate the event dispatcher service instead, but this only works in 10.3.

If we want this on 10.2 also, we can create a compiler pass similar to https://git.drupalcode.org/project/drupal/-/commit/6e733866fe414d0521be3... that only works for <10.3 (eg using deprecation helper)

lussoluca’s picture

Status: Needs review » Postponed

Probably, decorating the event_subscriber is no longer possible until #2909185: Replace ContainerAwareEventDispatcher with Symfony EventDispatcher lands on Drupal 11 (required changes have been reverted in #3445525: Add BC layer for contrib modules using ContainerAwareEventDispatcher as a typehint (BC fix for #2909185))

bkosborne’s picture

Status: Postponed » Fixed

Looks like this was already done in this commit which was released in 1.1.0.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.