Skip to content

Commit

Permalink
Make PDOCollector easy to extend (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
parallels999 committed Feb 10, 2024
1 parent 9126915 commit 958ac08
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/DebugBar/DataCollector/PDO/PDOCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,23 +204,25 @@ protected function collectPDO(TraceablePDO $pdo, TimeDataCollector $timeCollecto
*/
public function getName()
{
return 'pdo';
return 'database';
}

/**
* @return array
*/
public function getWidgets()
{
$name = $this->getName();

return array(
"database" => array(
"$name" => array(
"icon" => "database",
"widget" => "PhpDebugBar.Widgets.SQLQueriesWidget",
"map" => "pdo",
"map" => "$name",
"default" => "[]"
),
"database:badge" => array(
"map" => "pdo.nb_statements",
"$name:badge" => array(
"map" => "$name.nb_statements",
"default" => 0
)
);
Expand Down

0 comments on commit 958ac08

Please sign in to comment.