You are here

private function DatabaseController::getQuery in Devel 8

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Controller/DatabaseController.php \Drupal\webprofiler\Controller\DatabaseController::getQuery()
  2. 8.2 webprofiler/src/Controller/DatabaseController.php \Drupal\webprofiler\Controller\DatabaseController::getQuery()
  3. 4.x webprofiler/src/Controller/DatabaseController.php \Drupal\webprofiler\Controller\DatabaseController::getQuery()

Parameters

$profile ->getToken():

int $qid:

Return value

array

1 call to DatabaseController::getQuery()
DatabaseController::explainAction in webprofiler/src/Controller/DatabaseController.php

File

webprofiler/src/Controller/DatabaseController.php, line 79

Class

DatabaseController
Class DatabaseController

Namespace

Drupal\webprofiler\Controller

Code

private function getQuery(Profile $profile, $qid) {
  $this->profiler
    ->disable();
  $token = $profile
    ->getToken();
  if (!($profile = $this->profiler
    ->loadProfile($token))) {
    throw new NotFoundHttpException($this
      ->t('Token @token does not exist.', [
      '@token' => $token,
    ]));
  }

  /** @var DatabaseDataCollector $databaseCollector */
  $databaseCollector = $profile
    ->getCollector('database');
  $queries = $databaseCollector
    ->getQueries();
  $query = $queries[$qid];
  return $query;
}