Problem/Motivation

During updates on one of our sites, updating this module to 3.0.1 caused some issues in combination with chi-tek/drupal-code-generator version 2.5.1
We're getting the following error:
Error: Class 'DrupalCodeGenerator\Command\BaseGenerator' not found in /web/modules/contrib/hook_event_dispatcher/src/Generators/LegacyEventGenerator.php on line 14 #0 phar:///usr/local/bin/drush/vendor/composer/ClassLoader.php(444): include()

Steps to reproduce

Install version 3.0.1 in combination with chi-tek/drupal-code-generator 2.5.1

Proposed resolution

- Remove deprecated LegacyEventGenerator or at least make it compatible with all supported versions.
- Possibly restrict the drupal-code-generator version in composer.json?

Remaining tasks

Create patch

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

RandalV created an issue. See original summary.

randalv’s picture

StatusFileSize
new2.32 KB

Adding a patch that removes the legacy component for now as a quick fix, this is probably not the correct solution but I don't have the time to find one that would work right now.

randalv’s picture

StatusFileSize
new2.33 KB

My apologies, the patch was corrupted by a previous change.

thomas.lobjoie’s picture

Thanks for this patch, just a quick note that this only apply when using Drush 11. If you are still using Drush 10, then an other error comes up. Which I opened aticket for here: https://www.drupal.org/project/hook_event_dispatcher/issues/3282632

el7cosmos’s picture

Drush should only pick one of the two services, can you see if running drush cache:rebuild solves the problem

Marios Anagnostopoulos made their first commit to this issue’s fork.

marios anagnostopoulos’s picture

StatusFileSize
new2.73 KB

I also did not have time to look into it, so I just re-rolled the quick fix of #3 for 3.3.1

DieterHolvoet made their first commit to this issue’s fork.

dieterholvoet’s picture

Status: Active » Needs review

I found a better solution, removing the legacy service definition in the service provider if the class does not exist. I pushed it to the MR.

Status: Needs review » Needs work

The last submitted patch, 7: 3266861-6.patch, failed testing. View results

mxr576’s picture

@DieterHolvoet you have not opened an MR from 3266861 - easy mistake - therefore Drupal CI checked the latest uploaded patch, which failed, so it changed back the status to "Needs work".

dieterholvoet’s picture

Status: Needs work » Needs review

Right, thanks for the heads up.

mxr576’s picture

Status: Needs review » Reviewed & tested by the community

el7cosmos’s picture

Version: 3.0.1 » 3.x-dev
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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