NodeTestExceptionHooks.php

Namespace

Drupal\node_test_exception\Hook

File

core/modules/node/tests/modules/node_test_exception/src/Hook/NodeTestExceptionHooks.php

View source
<?php

declare (strict_types=1);
namespace Drupal\node_test_exception\Hook;

use Drupal\node\NodeInterface;
use Drupal\Core\Hook\Attribute\Hook;

/**
 * Hook implementations for node_test_exception.
 */
class NodeTestExceptionHooks {
    
    /**
     * Implements hook_ENTITY_TYPE_insert() for node entities.
     */
    public function nodeInsert(NodeInterface $node) {
        if ($node->getTitle() == 'testing_transaction_exception') {
            throw new \Exception('Test exception for rollback.');
        }
    }

}

Classes

Title Deprecated Summary
NodeTestExceptionHooks Hook implementations for node_test_exception.

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