Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed eav_config_entity throwing error message on removed entity model #3338

Merged
merged 5 commits into from
Jun 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/code/core/Mage/Eav/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,23 @@ protected function _loadEntityTypes()
$this->_entityTypes = [];
$this->_entityTypeByCode = [];
$entityTypeCollection = Mage::getResourceModel('eav/entity_type_collection');

/** @var Mage_Eav_Model_Entity_Type $entityType */
foreach ($entityTypeCollection as $entityType) {
// Ensure eav entity type model class is defined, otherwise skip processing it.
// This check prevents leftover eav_entity_type entries from disabled/removed modules creating errors and
// is necessary because the entire EAV model is now loaded eagerly for performance optimization.
$entityModelClass = $entityType['entity_model'];
$fqEntityModelClass = Mage::getConfig()->getModelClassName($entityModelClass);
if (!class_exists($fqEntityModelClass)) {
if (Mage::getIsDeveloperMode()) {
throw new Exception('Failed loading of eav entity type because it does not exist: ' . $entityModelClass);
} else {
Mage::log('Skipped loading of eav entity type because it does not exist: ' . $entityModelClass);
}
continue;
}

davidhiendl marked this conversation as resolved.
Show resolved Hide resolved
$this->_entityTypes[$entityType->getId()] = $entityType;
$this->_entityTypeByCode[$entityType->getEntityTypeCode()] = $entityType;
}
Expand Down
Loading