You are here

protected function EntityTestUpdateStorage::saveToDedicatedTables in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/entity_test_update/src/EntityTestUpdateStorage.php \Drupal\entity_test_update\EntityTestUpdateStorage::saveToDedicatedTables()

Saves values of fields that use dedicated tables.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.

bool $update: TRUE if the entity is being updated, FALSE if it is being inserted.

string[] $names: (optional) The names of the fields to be stored. Defaults to all the available fields.

Overrides SqlContentEntityStorage::saveToDedicatedTables

File

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

Class

EntityTestUpdateStorage
Helper class for entity update testing.

Namespace

Drupal\entity_test_update

Code

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