laravel-doctrine / orm

An integration library for Laravel and Doctrine ORM
MIT License
828 stars 178 forks source link

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

Closed rosamarsky closed 1 month ago

rosamarsky commented 3 years ago

Expected behaviour

Queries are displaying on the Queries page

Actual behaviour

image

eigan commented 3 years ago

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.

rosamarsky commented 3 years ago

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 :)

eigan commented 3 years ago

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

TomHAnderson commented 1 month ago

Closing; expired.