Acts on a saved entity before the insert or update hook is invoked.
Used after the entity is saved, but before invoking the insert or update hook.
$update: (bool) TRUE if the entity has been updated, or FALSE if it has been inserted.
protected function postSave(EntityInterface $entity, $update) {
// Delete the original configuration entity, in case the entity ID was
// renamed.
if ($update && !empty($entity->original) && $entity->{$this->idKey} !== $entity->original->{$this->idKey}) {
// @todo This should just delete the original config object without going
// through the API, no?
$entity->original
->delete();
}
}