Objectives & prerequisites
- Explain how updating a referenced entity may impact the correctness or coherence of your data.
- Explain why reusing or repurposing existing entities should be considered carefully.
- Basic content management operations
- Working with entities and fields
- Working with reference fields
Replacing a Media entity's file
A Media entity represents a media file and contains a number of other fields that provide metadata.
When a media entity is used in content elsewhere, that content references the media entity; it doesn't reference the actual file inside the media entity, though in the end it's that media file that will to be shown on on the page referencing it.
This is no different from content referencing other content, other users, other taxonomy terms...
Importantly, when you use (or rather: reference) the same media entity on different pages, you only need to update the file contained within the media entity once, and all pages will show the new file.
Again, this is identical to tagging content with a taxonomy term (such as "favourite") and later on changing the label of that term to "favorite" to reflect a different spelling. All of the content that was tagged with "favourite" is now automatically tagged with "favorite", because the same term is still being referenced.
Conclusion
Changing the label (or any other field) of a referenced entity does not change the physical relationship (relationship still exists) between the referencing entity and the referenced entity, but it may change the logical relationship (relationship may no longer make logical sense).
Renaming referenced items
Being able to change a referenced item's properties without affecting any possible relationships to other entities makes working with entities powerful and flexible, but also has the potential for unwanted side effects.
Example 1: updating a media image
Imagine a Media entity - a partner company logo - shown on 100 articles. By now you know that those 100 articles all reference that one single Media entity.
When that partner has a new logo, you only need to upload a new file to the Media entity, and all articles will automatically show the new image.
That's super useful and easy, but it's your responsibility to be aware of all the entities that will now show the updated logo, and you can't have some entities showing the old logo while others show the new one. It's all or nothing.
Example 2: updating a taxonomy term name
Imagine you have a taxonomy to categorize articles, and you have tagged 100 articles with the term "technology" (term 145, for example).
When you update that term's label to "tech", all those 100 tagged articles will now show the label "tech". That's great, and exactly what you wanted.
But it's your responsibility to make sure that updating a term label makes logical sense. If you change the label to "politics", all those 100 articles that discuss technology topics will now show the label "politics" which probably doesn't make sense.
Logically, this categorization no longer makes sense. Drupal will not protect you against this because technically there is no error, and Drupal can't know that changing a "tech" label to "politics" doesn't make sense.
Conclusion
When you change a referenced entity's properties, it's your responsibility to make sure that the changes still make sense to the entities that reference it.
Activity
Fatima, one of the journalists / editors of your news site quits their job and moves to a different newspaper.
Would it be a good idea to reuse their Drupal account and simply change the username, email address and password? Why (not)?
This is generally not a good idea.
If you simply change the details from Fatima to Alex, all the content they created is now assumed to be created by Alex.
Any user reference fields that referenced Fatima now reference Alex, so if I was following Fatima's news feed, I'm now suddenly following Alex' feed, which is confusing.
If I had a private message system on my site, the private message history between myself and Fatima would now be shown as messages between myself and Alex, which is incorrect.
Also, Alex now has full access to these messages, which are none of his business. This is a privacy issue, and potentially a legal problem as well.
Overall, it just doesn't make sense to reuse (or make significant changes) to entities that are often referenced.
A change in name, gender, address, ... doesn't change who the entity represents, so that's not a problem. But reusing an entity to represent a completely different user, or a different taxonomy term, or a product, ... is a risk and will likely result in incorrect or incoherent data.
Summary
Changing the label (or any other field) of a referenced entity does not change the physical relationship between the referencing entity and the referenced entity, but it may change their logical relationship.
When you change a referenced entity's properties, it's your responsibility to make sure that the changes still make sense to the entities that reference it.