Problem/Motivation

After upgrading from 2.5.0 to 3.2.0 I get the following error when attempting a drush updb:

Error: Class 'DrupalCodeGenerator\Command\ModuleGenerator' not found in /app/docroot/modules/contrib/hook_event_dispatcher/src/Generators/EventGenerator.php on line 11

Steps to reproduce

Upgrading this module from 2.5.0 to 3.2.0, then run drush updb.

Proposed resolution

Looking closer at this error, I realised that the missing class is part of a newer version of the chi-teck/drupal-code-generator.
Drush 10 requires ^1.32.1 of this package, which doesn't contain that class.
Drush 11 requires ^2.4 of this package, which contain that class.

I was on Drush 10 so I thought I will upgrade to Drush 11 and that will fix the issue. And it did :-) But now I have a the following error:

Error: Class 'DrupalCodeGenerator\Command\BaseGenerator' not found in /app/docroot/modules/contrib/hook_event_dispatcher/src/Generators/LegacyEventGenerator.php on line 14

As it seems that now the DrupalCodeGenerator\Command\BaseGenerator has been removed from that package.

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

thomas.lobjoie created an issue. See original summary.

thomas.lobjoie’s picture

Issue summary: View changes
el7cosmos’s picture

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

bob.hinrichs’s picture

The drush cache clear is not resolving it for me. This makes it impossible to enable webprofiler.

marcosdr’s picture

Hi Thomas :)

For upgrading from version 2.5 to 3.x. The release candidate version still uses the BaseGenerator class. This worked for me without having to update drush.

composer require 'drupal/hook_event_dispatcher:3.0.0-rc1'

On the downside, you will be using deprecated constants from HookEventDispatcherInterface instead of for example those in UserHookEvents.

  • el7cosmos committed 4f3d172d on 3.x
    Issue #3282632 by el7cosmos, thomas.lobjoie: DrupalCodeGenerator\Command...
el7cosmos’s picture

Version: 3.2.0 » 3.x-dev
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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