function StatementExecutionSubscriber::onStatementExecutionEnd

Same name in other branches
  1. 10 core/lib/Drupal/Core/Database/EventSubscriber/StatementExecutionSubscriber.php \Drupal\Core\Database\EventSubscriber\StatementExecutionSubscriber::onStatementExecutionEnd()

Subscribes to a statement execution finished event.

Logs the statement query if logging is active.

Parameters

\Drupal\Core\Database\Event\StatementExecutionEndEvent $event: The database event.

File

core/lib/Drupal/Core/Database/EventSubscriber/StatementExecutionSubscriber.php, line 31

Class

StatementExecutionSubscriber
Response subscriber to statement executions.

Namespace

Drupal\Core\Database\EventSubscriber

Code

public function onStatementExecutionEnd(StatementExecutionEndEvent $event) : void {
    $logger = Database::getConnection($event->target, $event->key)
        ->getLogger();
    if ($logger) {
        $logger->logFromEvent($event);
    }
}

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