orm icon indicating copy to clipboard operation
orm copied to clipboard

[PROPOSAL] It would be nice to see Doctrine queries in Laravel Telescope

Open rosamarsky opened this issue 4 years ago • 3 comments

Expected behaviour

Queries are displaying on the Queries page

Actual behaviour

image

rosamarsky avatar Sep 14 '21 15:09 rosamarsky

You might be able to build this by creating a logger.

See https://github.com/laravel-doctrine/orm/blob/9dc7790f86c2013fc43a733bde50efc0ec17881e/src/Loggers/LaravelDebugbarLogger.php for inspiration, and https://github.com/laravel/telescope/blob/4.x/src/Watchers/QueryWatcher.php for how to push to Telescope. Looks like Telescope::recordQuery is the way.

Register your logger in config/doctrine.php at the logger key (which should use the DOCTRINE_LOGGER environment variable.

eigan avatar Sep 15 '21 06:09 eigan

You might be able to build this by creating a logger.

See https://github.com/laravel-doctrine/orm/blob/9dc7790f86c2013fc43a733bde50efc0ec17881e/src/Loggers/LaravelDebugbarLogger.php for inspiration, and https://github.com/laravel/telescope/blob/4.x/src/Watchers/QueryWatcher.php for how to push to Telescope. Looks like Telescope::recordQuery is the way.

Register your logger in config/doctrine.php at the logger key (which should use the DOCTRINE_LOGGER environment variable.

Thanks, I think it will help me a lot :)

rosamarsky avatar Sep 15 '21 12:09 rosamarsky

@rosamarsky Relevant PR opened recently: #501. This might make the telescope QueryWatcher work as expected.

eigan avatar Sep 22 '21 10:09 eigan