Islandora / controlled_access_terms

Drupal module for subject and agents
GNU General Public License v2.0
7 stars 28 forks source link

[BUG] Deleting a term does not delete Typed Relation references to it. #86

Closed rosiel closed 1 year ago

rosiel commented 1 year ago

What steps does it take to reproduce the issue?

Screenshot showing the typed relation with a type but no term content. Devel's node JSON showing intact reference to missing term

Which version of Islandora are you using? the version on the sandbox. The real question is what version of controlled access terms? Which is not apparent from the interface.

Any related open or closed issues to this bug report?

Not that I know of

Screenshots: inline

EDIT: this is not a Typed Relation issue. This is how Drupal Entity Relationship fields work too.

rosiel commented 1 year ago

DGI just released https://github.com/discoverygarden/entity_reference_integrity_extra which may affect this issue. Their module makes Entity Reference Integrity work with Typed Relations fields.

Entity Reference Integrity lets you query what references a given entity. It is not clear if Entity Reference Integrity allows you to do what I was attempting: Delete a term and all relationships to it. It does however have a submodule which would allow you to "protect" the integrity, thereby preventing you from deleting an entity (through the GUI only perhaps?) that is referenced to by other entities.

rosiel commented 1 year ago

This is just how Drupal works.

When you delete an entity, any references to it are NOT automatically deleted. They do not usually appear on the front-end, because they are displayed as 'labels' or 'rendered entities' and Drupal renders nothing. However with Typed Relation fields the "type" stuff still gets displayed, so the weirdness is visible and obvious.

This revelation affects metadata in a huge way. Keeping these references around in the JSONLD is wrong.

In general, being able to "cleanly delete" any drupal entity in a way that excises all references to it would be very desirable!

I think the broader issue needs to be fixed, and that we should not try to paper over this in the UI to hide the fact that a Typed Relation points to a deleted entity.