class StatementExecutionEndEvent

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Database/Event/StatementExecutionEndEvent.php \Drupal\Core\Database\Event\StatementExecutionEndEvent

Represents the end of a statement execution as an event.

Hierarchy

  • class \Drupal\Component\EventDispatcher\Event extends \Symfony\Contracts\EventDispatcher\Event
    • class \Drupal\Core\Database\Event\DatabaseEvent extends \Drupal\Component\EventDispatcher\Event

Expanded class hierarchy of StatementExecutionEndEvent

10 files declare their use of StatementExecutionEndEvent
DatabaseEventsTest.php in core/tests/Drupal/Tests/Core/Database/DatabaseEventsTest.php
DatabaseEventSubscriber.php in core/modules/system/tests/modules/database_test/src/EventSubscriber/DatabaseEventSubscriber.php
DatabaseEventTest.php in core/tests/Drupal/KernelTests/Core/Database/DatabaseEventTest.php
Log.php in core/lib/Drupal/Core/Database/Log.php
PerformanceDataCollector.php in core/modules/system/tests/modules/performance_test/src/PerformanceDataCollector.php

... See full list

File

core/lib/Drupal/Core/Database/Event/StatementExecutionEndEvent.php, line 8

Namespace

Drupal\Core\Database\Event
View source
class StatementExecutionEndEvent extends DatabaseEvent {
    
    /**
     * Constructs a StatementExecutionEndEvent object.
     *
     * See 'Customizing database settings' in settings.php for an explanation of
     * the $key and $target connection values.
     *
     * @param int $statementObjectId
     *   The id of the StatementInterface object as returned by spl_object_id().
     * @param string $key
     *   The database connection key.
     * @param string $target
     *   The database connection target.
     * @param string $queryString
     *   The SQL statement string being executed, with placeholders.
     * @param array $args
     *   The placeholders' replacement values.
     * @param array $caller
     *   A normalized debug backtrace entry representing the last non-db method
     *   called.
     * @param float $startTime
     *   The time of the statement execution start.
     */
    public function __construct(int $statementObjectId, string $key, string $target, string $queryString, array $args, array $caller, float $startTime) {
        parent::__construct();
    }
    
    /**
     * Gets the query execution elapsed time.
     *
     * @return float
     *   The elapsed time.
     */
    public function getElapsedTime() : float {
        return $this->time - $this->startTime;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
DatabaseEvent::$time public property The time of the event.
StatementExecutionEndEvent::getElapsedTime public function Gets the query execution elapsed time.
StatementExecutionEndEvent::__construct public function Constructs a StatementExecutionEndEvent object. Overrides DatabaseEvent::__construct 1

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