Invalid delete behaviour - implementing parent-child associations

I want to model an association between parent entities and child. More specifically, I want to model a composition, i.e. the child entities cannot exist without their parent. (e.g., for the lack of a better intuitive example, think of a dog is composed of feet) That is, I have a 1-to-n association between parent and children. So far, this can easily by modeled in the domain model: Now, I want to specify the required delete behaviour: when a parent is deleted, all of the children need to be deleted as well. But deleting a children is not allowed directly (e.g. you cannot remove a single foot from a dog). Thus, I have configured the following delete behaviour: In my opinion, this makes totally sense and uses the tools that Mendix (I’m using 8.0.0 beta 2) provides out of the box. However in this combination, I get an error message “Invalid delete behaviour”. If I change either of the “On delete …” properties, the error is gone. Why is that? It seems Mendix is artificially (and unnecessarily) restricting its behviour. I probably can use ‘After delete’ (for parent) and ‘Before delete’ (for child) microflow event handlers to implement the behaviour myself. But this feels needless to me, since the functions are already there. I can also probably just get rid of the ‘On delete of child’ setting (set it to keep), and modify the module security so that nobody is allowed to delete that object. But that feels wrong, too. First, imho, this is a property of the domain model, not the security. Second (and related), it is not guaranteed that a co-worker (or myself) is aware of this property and accidentally grants delete rights, e.g. for new module roles. Thanks in advance for helpful explanations!
1 answers

The logic that triggers with these rules would be slightly different that what your usecase describes and it makes sense that they are invalid. (if you delete a Parent, it will start a delete action for all Childs. These child objects will need to be deleted before the parent object gets deleted, because otherwise you can’t check for the association if the parent side of the association is empty. But they can’t be deleted before the parent object is deleted. 

So this is a clash. 

(i probably made a mess of that text while typing it)

A workaround for this would be that you change your standard delete button to a microflow button

And as validation you’ll first check in the database with a retrieve, if there are any objects associated to your object which should be removed before being able to remove the object you are trying to delete.