Is there any D8 port in the pipeline? If not then we let's put up the plan so that others can help.
Summary of discussions as of May 2019
- Don't be confused about what this module does: If an entity is deleted, it will clean up references to that now deleted entity. This does not do the reverse (if an entity is deleted, delete the other entities that it references)
- Some initial D8 work has been done at https://github.com/penyaskito/field_reference_delete however it does not appear to be complete/functional
- For D8 core, see if #2723323: [META] Clean up references to deleted entities has progressed.
Comments
Comment #2
jibranWorking on this.
Comment #3
penyaskitoI needed a way of detecting orphan references, and thought that this would be the right place for something like that. Started https://github.com/penyaskito/field_reference_delete, sorry for the duplication and lack of collaboration but was in a rush. Do you think is it worth it?
Comment #4
David_Rothstein commentedI'm not really involved in maintaining this module anymore (at least not regularly) so if anyone from this thread wants commit access to work on the Drupal 8 version, just let me know. Thanks!
Comment #5
thtas commentedWe needed something like this for a current Drupal 8 project so I had a crack at putting something together.
It's not a straight port because it uses entity delete() calls instead of using straight DB queries and it also only applies to entity reference fields or fields which inherit from the base entity reference field type class.
It also includes some field configuration to allow us to turn off the delete behaviour for particular reference fields. The default behaviour is still to do the delete though.
https://github.com/thtas/field_reference_delete
Comment #6
David_Rothstein commentedHm.... what entities are you deleting exactly?
This purpose of this module isn't to delete entities at all... it's to react to entities which are being deleted and to clean up database records that refer to them. (And it deliberately doesn't use the API for those updates, since that can have many unwanted side effects, e.g. bad performance, triggering other hooks that do things in response to an entity update that would not be desirable for a "housekeeping" operation such as this one, etc).
So it sounds to me like the module you wrote is something else entirely... possibly more closely related to https://www.drupal.org/project/field_referenced_delete rather than this module (except it actually sounds different than that one too)?
Comment #7
thtas commentedAh yes sorry i guess i misunderstood how this module operates. My requirement was to tidy up entire groups of referenced entities when they are no longer referenced by something, not just their dangling field data. So it's kind of a reverse version of the field_referenced_delete module i guess? These names are so confusing!
Comment #8
David_Rothstein commentedHa, I agree the two names are confusing. If you decide to move your module over to drupal.org, good luck coming up with a third name :)
Comment #9
jibranComment #10
scottsawyer@thtas, I think you want field_referenced_delete (unfortunate name similarity). It is also in desperate need of a D8 port. You might want to post Github link over there and see if it can help jumpstart the conversation. https://www.drupal.org/project/field_referenced_delete/issues/2537100
Comment #11
dalinComment #12
dalin