Problem/Motivation
PHP Fatal error: Uncaught Error: Class "Drupal\commerce\Entity\CommerceContentEntityBase" not found in -drupal-10.4.x/html/modules/contrib/commerce_recruiting/src/Entity/Campaign.php:76
Steps to reproduce
When I install modules, I get this error.
It is because of the autoload in composer.json.
I haven't installed commerce yet.
Commerce_recruiting extends commerce: Campaign extends CommerceContentEntityBase but Commerce isn't available
Proposed resolution
remove autoloaders from composer.json
"autoload": {
"psr-4": {
"Drupal\\commerce_recruiting\\": "./src"
}
},
"autoload-dev": {
"psr-4": {
"Drupal\\Tests\\commerce_recruiting\\": "./tests/src"
}
},
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3532677-remove-autoload-composer-json.patch | 493 bytes | socialnicheguru |
Comments
Comment #2
socialnicheguru commentedComment #3
socialnicheguru commentedThis is not working because it is too late in the process. autoload-test is fine, but the other is causing problems as commerce is not autoloaded.
Comment #4
socialnicheguru commentedComment #5
ktpm commentedHi,
I removed the autoload section from the composer.json. Please update to the latest dev version and try again.
Note added: I did not notice any change or unexpected behaviour of the module, neither before nor after removing the autoload, module enabled or disabled. The described issue is not what I have observed from composer so far. Maybe there are version or plugin differences? But I agree that the autoload is most likely not needed in modules (anymore?) and probably comes from a template which I resorted to back then.
I hope it helps!
Comment #6
socialnicheguru commentedsuper thankful for the change. I created a local patch to remove it and it worked well so I am looking forward to converting back to yours.
Comment #7
ktpm commented