Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
EntityReferenceItem is missing dependency to the module that provides the target entity type.
- Steps to reproduce
- Install standard profile
- Uninstall Taxonomy
- Go to Article field settings and click Edit for the Tags field
- See error:
PluginNotFoundException: The "taxonomy_term" entity type does not exist. in Drupal\Core\Entity\EntityManager->getDefinition() (line 259 of core/lib/Drupal/Core/Entity/EntityManager.php).
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::schema(Object)
Proposed resolution
In EntityReferenceItem::calculateDependencies(), find and include the provider of the target entity type.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#8 | uUz5CAG.png | 41.01 KB | Artusamak |
#3 | er_target_dependency-2479991-3.interdiff.txt | 2.86 KB | Arla |
#3 | er_target_dependency-2479991-3.patch | 4.25 KB | Arla |
#3 | er_target_dependency-2479991-3-TEST_ONLY.patch | 2.04 KB | Arla |
#1 | er_target_dependency-2479991-1-TESTS_ONLY.patch | 2.05 KB | Arla |
Comments
Comment #1
ArlaBug trigger.
Comment #3
ArlaAttempted to fix. I realised that FieldStorageConfig is not even asking the field type for dependencies. This patch is how far I got for now. It produces an error because it passes the field storage, not the field, as parameter to the field type calculateDependencies.
Comment #6
alexpottComment #7
ArlaSo I guess it would be easy to make the field (instance) depend on the target type. Will look at that. But anyway the field storage should still depend on it as well.
Comment #8
ArtusamakThe problem indicated in the issue with the steps to reproduce is now working with HEAD.
When you uninstall the taxonomy module the entity reference field using it is also removed (field_tags). See below:
Then when you go in the content type configuration, everything is fine.
It looks like it's fixed to me.
Comment #9
catchComment #10
BerdirDoesn't look like this actually works now, otherwise #2520526: Calculate configuration entity dependencies on install wouldn't have to fix this problem :)
Keeping as closed but changing status to closed duplicate.
Comment #11
jackbravo CreditAttribution: jackbravo commented