-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow configuring behavior via the DOCTRINE_DEPRECATIONS env var #41
Conversation
Have you considered using a file auto-loaded with |
@greg0ire this would still force to load the Deprecations class on all requests even if they never trigger a deprecation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea! This will enable Symfony to ship a very simple recipe for integrating deprecations triggered by Doctrine packages into its own error handler.
@beberlei, what do you think?
Oh, and: can we cover this change with a test? 😬
With this option we would still have a problem about which package should set value of this env var by default. I don't think every user should configure this. |
☝🏻 just wanted to add this as well. Also, a bit surprising from a user‘s perspective since no other bundle/package/lib (that I am aware of) require setting env vars to have deprecations logged. Not saying that it’s not a nice feature to be able to turn this on via env vars, just like other software allows to turn on error logging/debugging in a similar way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good improvement
Maybe the idea was to use |
That would add the line to .env file, wouldn't it? That makes sense for options that user often need to change, but here, I can't see why would any symfony user want to opt out from this, seeing they can't opt out from this behaviour in core symfony components, those always do @trigger_error. Is there some use case I am missing where you want to have mixed deprecation trigger mechanisms in a project? Maybe I am too pedantic here, in the end it's better than nothing. But i see this env var as something that every symfony frramework user will have in their .env file but nobody will want to change. |
Quite unlikely to be changed indeed. Maybe the intended usage is something else, let's see. |
@ostrolucky if you want a no-configuration system for Symfony projects, it would require changing the default reporting mode of Doctrine to match the Symfony one. As long as defaults are not the same, we cannot have 0 configuration. |
Test case added, should be ready for merge. About your concern for Symfony @ostrolucky, I think we first thought about adding a line in the default recipe, but you're raising a valid point. I think I'd suggest going with a line in |
Thanks @nicolas-grekas ! |
See symfony/symfony#50468 for Symfony |
…ations as expected (nicolas-grekas) This PR was merged into the 6.3 branch. Discussion ---------- [FrameworkBundle][PhpUnitBridge] Configure doctrine/deprecations as expected | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix doctrine/DoctrineBundle#1662 | License | MIT | Doc PR | - Following doctrine/deprecations#41, so that deprecations from Doctrine take the same code path as any other deprecations in Symfony apps. Submitted to 6.3 to notify about the deprecations as early as possible but not too early to not trigger new deprecations in existing apps. Commits ------- cbe4808 [FrameworkBundle][PhpUnitBridge] Configure doctrine/deprecations as expected
In doctrine/DoctrineBundle#1662, we're discussing about how we should best integrate this lib in Symfony, where we'd like the default to be to call trigger_error.
In order to not force autoloading the
Deprecations
class on every single request just to configure it, I propose to allow configuring the default behavior via theDOCTRINE_DEPRECATIONS
env var.