protected function ConfigStorageController::postSave

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.

Parameters

$update: (bool) TRUE if the entity has been updated, or FALSE if it has been inserted.

2 calls to ConfigStorageController::postSave()
ConfigStorageController::save in drupal/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
Implements Drupal\Core\Entity\EntityStorageControllerInterface::save().
ViewStorageController::postSave in drupal/core/modules/views/lib/Drupal/views/ViewStorageController.php
Overrides Drupal\config\ConfigStorageController::postSave().
1 method overrides ConfigStorageController::postSave()
ViewStorageController::postSave in drupal/core/modules/views/lib/Drupal/views/ViewStorageController.php
Overrides Drupal\config\ConfigStorageController::postSave().

File

drupal/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php, line 379
Definition of Drupal\Core\Config\Entity\ConfigStorageController.

Class

ConfigStorageController
Defines the storage controller class for configuration entities.

Namespace

Drupal\Core\Config\Entity

Code

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();
  }
}