class EntityTestUpdateStorage

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/entity_test_update/src/EntityTestUpdateStorage.php \Drupal\entity_test_update\EntityTestUpdateStorage
  2. 10 core/modules/system/tests/modules/entity_test_update/src/EntityTestUpdateStorage.php \Drupal\entity_test_update\EntityTestUpdateStorage
  3. 8.9.x core/modules/system/tests/modules/entity_test_update/src/EntityTestUpdateStorage.php \Drupal\entity_test_update\EntityTestUpdateStorage

Helper class for entity update testing.

Hierarchy

Expanded class hierarchy of EntityTestUpdateStorage

See also

\Drupal\KernelTests\Core\Entity\FieldableEntityDefinitionUpdateTest::testFieldableEntityTypeUpdatesErrorHandling()

File

core/modules/system/tests/modules/entity_test_update/src/EntityTestUpdateStorage.php, line 13

Namespace

Drupal\entity_test_update
View source
class EntityTestUpdateStorage extends SqlContentEntityStorage {
  
  /**
   * {@inheritdoc}
   */
  protected function saveToDedicatedTables(ContentEntityInterface $entity, $update = TRUE, $names = []) {
    // Simulate an error during the 'restore' process of a test entity.
    if (\Drupal::state()->get('entity_test_update.throw_exception', FALSE)) {
      throw new \Exception('Peekaboo!');
    }
    parent::saveToDedicatedTables($entity, $update, $names);
  }

}

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