Class DrupalCodeGenerator\Command\BaseGenerator not found in ExtraFieldDisplay

Created on 22 February 2023, almost 2 years ago
Updated 12 April 2023, almost 2 years ago

Problem/Motivation

The module is not managing correctly its dependencies, at composer.json there's no entry for drupal-code-generator package (https://github.com/Chi-teck/drupal-code-generator). So when now we install version 2.3 of this module it want to use class DrupalCodeGenerator\Command\BaseGenerator at src/Generators/ExtraFieldDisplay.php.

Checking who provides that is: https://github.com/Chi-teck/drupal-code-generator

At its version 3 they had incorporated such class: https://github.com/Chi-teck/drupal-code-generator/blob/3.x/src/Command/B...

First: Your module should declare the dependency to this module if it depends on it
Second: Older versions of drupal-code-generator doesn't have that class.

Now comes the delicate part: Drush 11 is demanding version ^2.4 (https://packagist.org/packages/drush/drush#11.5.1). So one cannot have drush/drush and extra_field now working together:

- drush/drush 11.4.0 requires chi-teck/drupal-code-generator ^2.4 -> found chi-teck/drupal-code-generator[dev-master, 2.4.0, ..., 2.x-dev (alias of dev-master)] but it conflicts with your root composer.json require (^3.0).

Steps to reproduce

We installed a site with:

  • "drush/drush": "^11" --> Brings drush 11.4.0
  • "drupal/extra_field": "^2.2" --> Brings extra_field 2.3

Then we install webprofiler module and when we ran drush en webprofiler we get:

Error: Class "DrupalCodeGenerator\Command\BaseGenerator" not found in /home/abel-santos-corral/openeuropa/ema-ema-dev/web/modules/contrib/extra_field/src/Generators/ExtraFieldDisplay.php on line 14 

Could you please check?

Maybe as is now the module should use any other class from drupal-code-generator and putting the dependency is possible to have it more controlled.

🐛 Bug report
Status

Closed: duplicate

Version

2.3

Component

Code

Created by

🇪🇸Spain abelcain Madrid

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

Comments & Activities

Production build 0.71.5 2024