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

Comments

socialnicheguru created an issue. See original summary.

socialnicheguru’s picture

Status: Active » Needs review
StatusFileSize
new493 bytes
socialnicheguru’s picture

This 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.

socialnicheguru’s picture

Status: Needs review » Needs work
ktpm’s picture

Status: Needs work » Needs review

Hi,

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!

socialnicheguru’s picture

super 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.

ktpm’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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