This project is not covered by Drupal’s security advisory policy.

INTRODUCTION

This module manages cascading deletion on associated entities.

INSTALLATION

To correctly install the Cascading Deletion module it is necessary:

  • launch the command:
    composer require drupal/cascading_deletion
  • enable the module

EXAMPLES

Foo is father entity type of Bar (in relation 1 to N, for example).

Deleting a Foo entity instance, all Bar entity instances with a reference to Foo (if enabled from field settings) will be deleted too.

At this point, if there are other entity types related to Bar, they will be deleted.

CONFIGURATION

Base Field Definition

In entity static function "baseFieldDefinitions", add the cascading deletion setting in the as follow:
->setSetting('cascading_deletion', ['enabled' => TRUE])

Field Config

In edit field configuration form of entity reference fields, it is shown a section called "Cascading Deletion".
It is just necessary check the checkbox and the module will be in charge of the rest.

Supporting organizations: 

Project information

Releases