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.
Issue fork hook_event_dispatcher-3282632
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
Comment #2
thomas.lobjoie commentedComment #3
el7cosmosDrush should only pick one of the two services, can you see if running
drush cache:rebuildsolves the problemComment #4
bob.hinrichs commentedThe drush cache clear is not resolving it for me. This makes it impossible to enable webprofiler.
Comment #5
marcosdr commentedHi 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.
Comment #8
el7cosmos