class DatabaseEventEnabler

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/performance_test/src/DatabaseEventEnabler.php \Drupal\performance_test\DatabaseEventEnabler

Hierarchy

Expanded class hierarchy of DatabaseEventEnabler

File

core/modules/system/tests/modules/performance_test/src/DatabaseEventEnabler.php, line 12

Namespace

Drupal\performance_test
View source
class DatabaseEventEnabler implements HttpKernelInterface {
    public function __construct(HttpKernelInterface $httpKernel, Connection $connection) {
    }
    
    /**
     * {@inheritdoc}
     */
    public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE) : Response {
        if ($type === static::MAIN_REQUEST) {
            $this->connection
                ->enableEvents([
                // StatementExecutionStartEvent must be enabled in order for
                // StatementExecutionEndEvent to be fired, even though we only subscribe
                // to the latter event.
StatementExecutionStartEvent::class,
                StatementExecutionEndEvent::class,
            ]);
        }
        return $this->httpKernel
            ->handle($request, $type, $catch);
    }

}

Members

Title Sort descending Modifiers Object type Summary
DatabaseEventEnabler::handle public function
DatabaseEventEnabler::__construct public function

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