How to delete children when main entity is deleted? I am looking for the best way to delete children of my main entity when i delete it.
I have 2 entity type :

commandes_entity
commandes_ligne_entity ( entity reference to commandes_entity )

The only way i have found is to create a hook_entity_delete :

Edit :  This is how i delete children :

function boutique_commandes_entity_delete(Drupal\Core\Entity\EntityInterface $entity)
{
  $query = \Drupal::database()-&gt;delete('commandes_lignes_entity');
  $query-&gt;condition('commandes_id', $entity-&gt;get('id')-&gt;value);
  $query-&gt;execute();
}

Is there another way (maybe better) for delete children ?
You could use rules  to react to an entity being deleted, then add a loop over the reference field and use entity delete for the current list item.

Currently on my phone so apoligies for the compact answer.