Created on 12 January 2025, 3 months ago

Good day,

I cannot merge a term (no matter new term or existing), error:

The website encountered an unexpected error. Try again later.

TypeError: Drupal\term_merge\TermMerger::__construct(): Argument #3 ($dispatcher) must be of type Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher, Symfony\Component\EventDispatcher\EventDispatcher given, called in /var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\term_merge\TermMerger->__construct() (line 56 of modules/contrib/term_merge/src/TermMerger.php).

Drupal 11.

Any solution?

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada superfedya

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

Comments & Activities

  • Issue created by @superfedya
  • πŸ‡ΈπŸ‡ͺSweden mscweb

    Experiencing the same issues on 11.1.0

    As according to the error the issue stems from Drupal/Component/DependencyInjection/Container.php where definitions and arguments of the object with id "term_merge.term_merger" are resolved (as I understand it).

    On line 237 in container.php the code $arguments = $this->resolveServicesAndParameters($arguments); resolves the service "event_dispatcher" to a Symfony\Component\EventDispatcher\EventDispatcher.

    Though in term_merge\src\TermMerger.php it is specified to use the Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher. However, ContainerAwareEventDispatcher was deprecated as of drupal 10.3.0 ( https://www.drupal.org/node/3376090 β†’ ) in favor of Symfony\Component\EventDispatcher\EventDispatcher. This leads me to suspect that Drupal is resolving EvenDispatcher to the preferred one from Symfony but the module is still specifying to use the Drupal ContainerAwareEventDispatcher.

    Changing Drupal\Component\EventDispatcher\ContainerAwareEventDispatche to Symfony\Component\EventDispatcher\EventDispatche as well as ContainerAwareEventDispatcher to EventDispatcher in TermMerger.php resolves the issue.

  • niharika.s β†’ made their first commit to this issue’s fork.

  • πŸ‡ͺπŸ‡ΈSpain joristhedrupalist

    Yes same here 11.1.1
    here is a patch as the fix is very simple

  • πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru
  • πŸ‡¨πŸ‡¦Canada superfedya

    The patch doesn't works for me.

    Drupal\term_merge\TermMerger::__construct(): Argument #3 ($dispatcher) must be of type Symfony\Component\EventDispatcher\EventDispatcher, Drupal\tracer\EventDispatcher\TraceableEventDispatcher given, called in /www/site/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259

    in /www/site/web/modules/contrib/term_merge/src/TermMerger.php (line 56)

  • πŸ‡²πŸ‡ΎMalaysia stevechai

    Hi, the patch is working for term_merge 2.0.0-beta6 on drupal 11.1. Thanks for the patch.

Production build 0.71.5 2024