function ConfigTest::postSave

Same name in other branches
  1. 9 core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest::postSave()
  2. 10 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 97

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() == 'deleter') {
        $deletee = $storage->load('deletee');
        $deletee->delete();
    }
}

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