function ConfigTest::postSave

Same name and namespace in other branches
  1. 9 core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest::postSave()
  2. 8.9.x core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest::postSave()
  3. 11.x core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest::postSave()

Overrides EntityBase::postSave

File

core/modules/config/tests/config_test/src/Entity/ConfigTest.php, line 107

Class

ConfigTest
Defines the ConfigTest configuration entity.

Namespace

Drupal\config_test\Entity

Code

public function postSave(EntityStorageInterface $storage, $update = TRUE) {
  // Used to test secondary writes during config sync.
  if ($this->id() == 'primary') {
    $secondary = $storage->create([
      'id' => 'secondary',
      'label' => 'Secondary Default',
    ]);
    $secondary->save();
  }
  if ($this->id() == 'dependency') {
    $dependent = $storage->load('dependent');
    $dependent->delete();
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.