function SqlContentEntityStorage::wrapSchemaException

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::wrapSchemaException()
  2. 10 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::wrapSchemaException()
  3. 11.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::wrapSchemaException()

Wraps a database schema exception into an entity storage exception.

Parameters

callable $callback: The callback to be executed.

Throws

\Drupal\Core\Entity\EntityStorageException When a database schema exception is thrown.

8 calls to SqlContentEntityStorage::wrapSchemaException()
SqlContentEntityStorage::onEntityTypeCreate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the creation of the entity type.
SqlContentEntityStorage::onEntityTypeDelete in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the deletion of the entity type.
SqlContentEntityStorage::onEntityTypeUpdate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the update of the entity type.
SqlContentEntityStorage::onFieldableEntityTypeCreate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the creation of the fieldable entity type.
SqlContentEntityStorage::onFieldableEntityTypeUpdate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Reacts to the update of a fieldable entity type.

... See full list

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 1587

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

protected function wrapSchemaException(callable $callback) {
    $message = 'Exception thrown while performing a schema update.';
    try {
        $callback();
    } catch (SchemaException $e) {
        $message .= ' ' . $e->getMessage();
        throw new EntityStorageException($message, 0, $e);
    } catch (DatabaseExceptionWrapper $e) {
        $message .= ' ' . $e->getMessage();
        throw new EntityStorageException($message, 0, $e);
    }
}

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