- Issue created by @mohammad-fayoumi
- Merge request !15Issue #3512755: check to skip non-existent entities → (Open) created by mohammad-fayoumi
When running the Site Audit module in Drupal 10, the following error occurs during the calculateScore() method execution:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "custom_entity" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 142 of /core/lib/Drupal/Core/Entity/EntityTypeManager.php).
The issue arises because the calculateScore() method processes all field mappings retrieved from entity_field.manager->getFieldMap()
. This includes field configurations for entity types that no longer exist in the system (e.g., due to improper uninstallation of a module or custom entity type). When attempting to retrieve the definition of a non-existent entity type using entity_type.manager->getDefinition(), a PluginNotFoundException is thrown.
Add a check to ensure that only existing entity types are processed. Modify the calculateScore() method to skip non-existent entity types using the hasDefinition() method of the entity_type.manager service.
Active
4.0
Code