Skip to content

Commit 1a05b80

Browse files
authored
Merge pull request #960 from cakephp/5.x-doc-sql-trace-trait
5.x: add docs for SqlTraceTrait
2 parents b4d7829 + a823997 commit 1a05b80

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

docs/en/index.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ you've removed it and want to re-install it, you can do so by running the
2020
following from your application's ROOT directory (where composer.json file is
2121
located)::
2222

23-
php composer.phar require --dev cakephp/debug_kit "~4.0"
23+
php composer.phar require --dev cakephp/debug_kit "~5.0"
2424

2525
Then, you need to enable the plugin by executing the following line::
2626

@@ -316,3 +316,20 @@ Helper Functions
316316

317317
* ``sql()`` Dumps out the SQL from an ORM query.
318318
* ``sqld()`` Dumps out the SQL from an ORM query, and exits.
319+
320+
Tracing query execution
321+
=======================
322+
323+
Sometimes you need to know where specific queries are being executed in your app.
324+
To get this kind of information you can add the ``SqlTraceTrait`` to your Table class like so::
325+
326+
use DebugKit\Model\Table\SqlTraceTrait;
327+
328+
class CategoriesTable extends Table
329+
{
330+
use SqlTraceTrait;
331+
}
332+
333+
This will add the following information to the SQL log::
334+
335+
/* APP/Controller/CategoriesController.php (line 20) *)

0 commit comments

Comments
 (0)