Commerce generate fatal php errors

Created on 9 April 2024, 3 months ago
Updated 24 June 2024, 4 days ago

Problem/Motivation

Experiencing drush failure as soon as this module installed.
And subsequently trying to run any drush command:

Error: Class "Drupal\devel_generate\Commands\DevelGenerateCommands" not found (line 10 #0 /Users/me/Sites/xxxx/drupal/vendor/composer/ClassLoader.php(576): include()
#1 /Users/me/Sites/xxxx/drupal/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('/Users/richardw...')
#2 [internal function]: Composer\Autoload\ClassLoader->loadClass('Drupal\\devel_ge...')
#3 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(192): ReflectionClass->__construct('Drupal\\devel_ge...')
#4 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(174): Drush\Runtime\LegacyServiceInstantiator->instantiateObject('Drupal\\devel_ge...', Array)
#5 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(131): Drush\Runtime\LegacyServiceInstantiator->create('Drupal\\devel_ge...', Array, Array)
#6 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(60): Drush\Runtime\LegacyServiceInstantiator->instantiateServices(Array)
#7 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Boot/DrupalBoot8.php(257): Drush\Runtime\LegacyServiceInstantiator->loadServiceFiles(Array)
#8 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Boot/DrupalBoot8.php(233): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands(Object(Drush\Boot\BootstrapManager))
#9 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Boot/BootstrapManager.php(236): Drush\Boot\DrupalBoot8->bootstrapDrupalFull(Object(Drush\Boot\BootstrapManager), NULL)
#10 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Boot/BootstrapManager.php(422): Drush\Boot\BootstrapManager->doBootstrap(5, 6, NULL)
#11 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Boot/BootstrapManager.php(357): Drush\Boot\BootstrapManager->bootstrapMax(6)
#12 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Boot/BootstrapManager.php(329): Drush\Boot\BootstrapManager->bootstrapToPhaseIndex(-2, Object(Consolidation\AnnotatedCommand\AnnotationData))
#13 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Boot/BootstrapHook.php(36): Drush\Boot\BootstrapManager->bootstrapToPhase('max', Object(Consolidation\AnnotatedCommand\AnnotationData))
#14 /Users/me/Sites/xxx/drupal/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(44): Drush\Boot\BootstrapHook->initialize(Object(Symfony\Component\Console\Input\ArgvInput), Object(Consolidation\AnnotatedCommand\AnnotationData))
#15 /Users/me/Sites/xxx/drupal/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(36): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->doInitializeHook(Object(Drush\Boot\BootstrapHook), Object(Symfony\Component\Console\Input\ArgvInput), Object(Consolidation\AnnotatedCommand\AnnotationData))
#16 /Users/me/Sites/xxx/drupal/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(29): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook(Object(Drush\Boot\BootstrapHook), Object(Symfony\Component\Console\Input\ArgvInput), Object(Consolidation\AnnotatedCommand\AnnotationData))
#17 /Users/me/Sites/xxx/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php(145): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize(Object(Symfony\Component\Console\Input\ArgvInput), Object(Consolidation\AnnotatedCommand\AnnotationData))
#18 /Users/me/Sites/xxx/drupal/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(376): Consolidation\AnnotatedCommand\CommandProcessor->initializeHook(Object(Symfony\Component\Console\Input\ArgvInput), Array, Object(Consolidation\AnnotatedCommand\AnnotationData))
#19 /Users/me/Sites/xxx/drupal/vendor/symfony/console/Command/Command.php(292): Consolidation\AnnotatedCommand\AnnotatedCommand->initialize(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /Users/me/Sites/xxx/drupal/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /Users/me/Sites/xxx/drupal/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /Users/me/Sites/xxx/drupal/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /Users/me/Sites/xxx/drupal/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /Users/me/Sites/xxx/drupal/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
#26 /Users/me/Sites/xxx/drupal/vendor/drush/drush/drush(4): require('/Users/richardw...')
#27 /Users/me/Sites/xxx/drupal/vendor/bin/drush(119): include('/Users/richardw...')
#28 {main}
Error: Class "Drupal\devel_generate\Commands\DevelGenerateCommands" not found in include() (line 10 of /Users/me/Sites/xxx/drupal/web/modules/contrib/devel_generate_commerce/src/Commands/CommerceDevelGenerateCommand.php).
 [warning] Drush command terminated abnormally.

And also when navigating to /admin/config/development/generate/commerce:
Fatal error: Type of Drupal\devel_generate_commerce\Plugin\DevelGenerate\CommerceDevelGenerate::$entityTypeManager must be Drupal\Core\Entity\EntityTypeManagerInterface (as in class Drupal\devel_generate\DevelGenerateBase) in /Users/me/Sites/xxx/drupal/web/modules/contrib/devel_generate_commerce/src/Plugin/DevelGenerate/CommerceDevelGenerate.php on line 38

Steps to reproduce

  • Install/enable module.
  • Navigate to /admin/config/development/generate/commerce - expected devel commerce generate page got fatal php error and drush errors.
  • Uninstall module, flush caches and drush returns to normal.

PHP v8.1.27
Drupal v10.2.5
Drush v12.5.1.0

This is a multisite install,
but all modules are installed globally in /web/modules/contrib/
And I'm only setting up the first site

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom rwhitehead

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

Comments & Activities

  • Issue created by @rwhitehead
  • πŸ‡©πŸ‡ͺGermany Grevil

    Just installed the module and I get the exact same error.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica
  • πŸ‡©πŸ‡ͺGermany Grevil

    This module in its current state is unusable. "DevelGenerateCommands" moved from "Drupal\devel_generate\Commands\DevelGenerateCommands" to "Drupal\devel_generate\Drush\Commands\DevelGenerateCommands" but is also declared final now.

    There is a different way on how to register devel_generate drush commands now, you simply have to copy the "generate" Method, where we need to call the devel_generate_commerce "CommerceDevelGenerate" plugin generate methods.

    But this isn't all. Even if we delete the Command file and try to generate the commerce entities via UI ("/admin/config/development/generate/commerce"), we get more an more errors thrown, as there are quite a few deprecations in "src/Plugin/DevelGenerate/CommerceDevelGenerate.php" which need to get fixed before this module can work again.

    Setting this issue to major, as the module isn't usable with devel 5.x in its current state.

  • πŸ‡²πŸ‡©Moldova andrei.vesterli Chisinau

    Hi guys

    Thx for this report. I didn't touch this module for a while. I didn't find big issues for D8 & D9. Of course, it has big issues for D10.

    It requires 2 versions for normal support.
    All I need is time.

Production build 0.69.0 2024