Skip to content

Commit 02d7fc6

Browse files
committed
Add debugging
1 parent d99da28 commit 02d7fc6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Readme.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,5 +252,20 @@ $qb->collection("Users")
252252
$result = $qb->toArray();
253253
var_dump($result);
254254
```
255+
**Debug Queries**:
256+
It is possible possible to debug the query pipeline built by the Query Builder for each query.
257+
```php
258+
QueryBuilder::$pipelineDebug = true; // Enable pipeline debugging!
259+
260+
// Run a query
261+
$result = (new QueryBuilder())->collection("xyz")
262+
->where("active", true)
263+
->findAll()
264+
->toArray();
265+
266+
// Fetch the pipeline built by the Query Builder
267+
var_dump(QueryBuilder::getLastPipelineLog()); // Get the pipeline built for the last query
268+
var_dump(QueryBuilder::getPipelineLogs()); // Get all pipelines ever built by the query builder
269+
```
255270

256271
**For more examples check out the `examples` directory.**

0 commit comments

Comments
 (0)