function EntityTestHooks::entityTestInsert

Implements hook_ENTITY_TYPE_insert() for 'entity_test'.

File

core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php, line 257

Class

EntityTestHooks
Hook implementations for entity_test.

Namespace

Drupal\entity_test\Hook

Code

public function entityTestInsert($entity) {
    if ($entity->name->value == 'fail_insert') {
        throw new \Exception("Test exception rollback.");
    }
}

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