dkan icon indicating copy to clipboard operation
dkan copied to clipboard

Deprecate, disuse EventDispatcherTrait

Open paul-m opened this issue 4 months ago • 0 comments

Current Behavior

Many services use Drupal\common\EventDispatcherTrait because we needed a backwards-compatibility layer between Drupal 8 and 9. See: https://github.com/GetDKAN/dkan/issues/3592

Currently, no one should be using Drupal 8, and we don't have Drupal 9 in our testing matrix.

Furthermore, services should be injected into other services, avoiding the \Drupal pattern.

So let's deprecate EventDispatcherTrait and remove its usage in DKAN.

Expected Behavior

  • Add a @deprecated annotation to EventDispatcherTrait.
  • Inject the event_dispatcher service into classes that currently use the trait.
  • Modify those classes to use their own dispatcher instead of the one called in the trait.

Steps To Reproduce

See that we use EventDispatcherTrait.

Decide that it's not a good pattern.

Fix it.

Relevant log output (optional)

No response

Anything else?

No response

paul-m avatar Oct 11 '24 19:10 paul-m