Skip to content

Commit c7f4e76

Browse files
committed
Merge pull request php-debugbar#6 from mikealmond/hotfix/docs-update
Update the base collectors doc to show how to collect multiple PDO connections
2 parents f666309 + 04a2332 commit c7f4e76

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/base_collectors.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ Logs SQL queries. You need to wrap your `PDO` object into a `DebugBar\DataCollec
6060
$pdo = new DebugBar\DataCollector\PDO\TraceablePDO(new PDO('sqlite::memory:'));
6161
$debugbar->addCollector(new DebugBar\DataCollector\PDO\PDOCollector($pdo));
6262

63+
You can even log queries from multiple `PDO` connections:
64+
65+
$pdoRead = new DebugBar\DataCollector\PDO\TraceablePDO(new PDO('sqlite::memory:'));
66+
$pdoWrite = new DebugBar\DataCollector\PDO\TraceablePDO(new PDO('sqlite::memory:'));
67+
68+
$pdoCollector = new DebugBar\DataCollector\PDO\PDOCollector();
69+
$pdoCollector->addConnection($pdoRead, 'read-db');
70+
$pdoCollector->addConnection($pdoWrite, 'write-db');
71+
72+
$debugbar->addCollector($pdoCollector);
73+
6374
## RequestData
6475

6576
Collects the data of PHP's global variables

0 commit comments

Comments
 (0)