This keyword defines the referential action that occurs when a record is deleted on the other side of a relationship.
Example
Class MyApp.Employee Extends %Persistent {
...
Relationship Employer As MyApp.Company [ Cardinality = one, Inverse = Employees, OnDelete = cascade ];
}
This example shows a one-to-many relationship between a company and its employees. As shown here, the Cardinality signifies that company is the “one” side of the relationship, while OnDelete indicates the effect of deleting the company on its employees. As the value of OnDelete is cascade, when a company is deleted, its effect cascades and the employees are also deleted.
If the value of OnDelete is noaction (the default for one-to-many relationships), deleting a company is not permitted if any employee has the company as its employer.
If the value of OnDelete is setnull or setdefault, deleting a company sets the employer of any of its employees to null.