php-debugbar icon indicating copy to clipboard operation
php-debugbar copied to clipboard

Support doctrine 3.x

Open erikn69 opened this issue 7 months ago • 8 comments

  • Closes #768
  • Closes #774

https://www.doctrine-project.org/projects/doctrine-orm/en/3.3/reference/configuration.html

The code was moved from \DebugBar\Bridge\DoctrineCollector to \DebugBar\Bridge\Doctrine\DoctrineCollector and the middleware was added, it keeps 2.x support on \DebugBar\Bridge\DoctrineCollector

the middleware wraps doctrine connection, is there a better way to achieve this?

UPDATE1: it seems that doctrine 3.x does not support php 8.0 UPDATE2: durationBackground added, events like transaction are now better differentiated, events are avoided from being counted as statements

erikn69 avatar Apr 21 '25 14:04 erikn69

Would it make more sense to create php-debugbar/doctrine-bridge or something?

barryvdh avatar Apr 25 '25 08:04 barryvdh

It's a bit difficult to pin dependencies and things like that. And making changes or upgrading in the future with breaking changes, make it also difficult.

barryvdh avatar Apr 25 '25 08:04 barryvdh

Would it make more sense to create php-debugbar/doctrine-bridge or something?

Maybe, but since there was already support for 2x I thought about adding it here. In that case, shouldn't all the bridges be separated? Monolog for example

It's a bit difficult to pin dependencies and things like that. And making changes or upgrading in the future with breaking changes, make it also difficult.

Is it because of the integration test? Yes, it's difficult.

erikn69 avatar Apr 25 '25 13:04 erikn69

well yeah it's mostly difficult because we don't actually add the depencies so we cannot bump anything.

barryvdh avatar Apr 25 '25 13:04 barryvdh

In my opinion, the only thing that saves this type of thing is that it is not a production package, you can adapt it to your local environment in your own way.

erikn69 avatar Apr 25 '25 13:04 erikn69

merge?.. New way is not worse performance-wise right?

drmax24 avatar Apr 30 '25 08:04 drmax24

New way is not worse performance-wise right?

That shouldn't be the case, but try it and tell us, I don't use Doctrine, I'm just trying to help

erikn69 avatar Apr 30 '25 13:04 erikn69

I think I'm gonna make a seperate repo. Just thinking about how to do it cleanly. Shall I make the base package and let @erikn69 PR his code (copy paste) it?

barryvdh avatar Apr 30 '25 13:04 barryvdh

Sorry for the delay, but I have create the repo here: https://github.com/php-debugbar/doctrine-bridge

I added the existing bridge, under 1 namespace deeper to avoid conflicts (so DebugBar\Bridge\Doctrine\DoctrineCollector instead of DebugBar\Bridge\DoctrineCollector

The tests seem to be passing, so if you want you can apply this PR there. Or I can copy it over if you prefer.

barryvdh avatar Jul 16 '25 08:07 barryvdh

We can the deprecate the bridge in this package, and remove it in 3.x. Perhaps we can do the same for Twig and perhaps others.

barryvdh avatar Jul 16 '25 08:07 barryvdh

Ok, I'll take a look at it.

erikn69 avatar Jul 16 '25 13:07 erikn69