DatabaseEventEnabler.php

Same filename and directory in other branches
  1. 10 core/modules/system/tests/modules/performance_test/src/DatabaseEventEnabler.php

Namespace

Drupal\performance_test

File

core/modules/system/tests/modules/performance_test/src/DatabaseEventEnabler.php

View source
<?php

namespace Drupal\performance_test;

use Drupal\Core\Database\Connection;
use Drupal\Core\Database\Event\StatementEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
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(StatementEvent::all());
        }
        return $this->httpKernel
            ->handle($request, $type, $catch);
    }

}

Classes

Title Deprecated Summary
DatabaseEventEnabler

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