itsgoingd / clockwork

Clockwork - php dev tools in your browser - server-side component
https://underground.works/clockwork
MIT License
5.68k stars 321 forks source link

Not working with doctrine/dbal 3.3 #583

Closed N-M closed 2 years ago

N-M commented 2 years ago

After the upgrade from doctrine/dbal 2 to 3.3 Clockwork stopped working. Removal of code below shows performance tab only.

 /** @var \Clockwork\Clockwork $clock */
$clock = $container->get('clockwork');
$clock->addDataSource(new DoctrineDataSource($entityManager));

image

itsgoingd commented 2 years ago

Hey, can you please provide more information about your app? From the code example it doesn't seem like a standard Laravel app.

N-M commented 2 years ago

It is the Slim app with Clockwork middleware.

I have made a test repo. This is a working example with dbal2 https://github.com/N-M/Slim-Skeleton image

An example with dbal3 that is not working can be found here https://github.com/N-M/Slim-Skeleton/tree/dbal3 image

If I comment out code below test app will work but without Database tab in Chrome plugin

/** @var \Clockwork\Clockwork $clock */
$clock = $c->get('clockwork');
$clock->addDataSource(new DoctrineDataSource($entityManager));

Please let me know if you need more details

itsgoingd commented 2 years ago

Thanks, this is very useful, will return to this tomorrow.

itsgoingd commented 2 years ago

Hey, I've finally got around to check this out. This should now be fixed in master and will be released soon, sorry for the long wait.

This was actually caused by resolving of the connection name for executed queries. In DBAL 2 this was implemented by looking at the configuration, this implementation changed in DBAL 3 to execute an actual query, thus leading to infinite recursion.

I've fixed this by resolving the connection name only once, early in the process, instead on every collected query.

N-M commented 2 years ago

Thank you @itsgoingd for resolving the issue. We are very happy with the tool.

itsgoingd commented 2 years ago

Glad you like it, this is now released as part of Clockwork 5.1.7.