Skip to content
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

[API] Add getWrappedDriver method to AbstractDriverMiddleware #6308

Open
oleg-andreyev opened this issue Feb 19, 2024 · 2 comments
Open

[API] Add getWrappedDriver method to AbstractDriverMiddleware #6308

oleg-andreyev opened this issue Feb 19, 2024 · 2 comments

Comments

@oleg-andreyev
Copy link

Feature Request

There are cases when it's required to extact$wrappedDriver but AbstractDriverMiddleware does not have such public api.

DamienHarper/auditor#184

Q A
New Feature yes
RFC yes

Summary

Adding get-method for $wrappedDriver

@derrabus
Copy link
Member

There are cases when it's required to extact$wrappedDriver

And which cases would that be? The middleware stacks are not designed to be unwrapped and that's kind of on purpose.

but AbstractDriverMiddleware does not have such public api.

Please be aware that AbstractDriverMiddleware is by no means a contract. It's a utility class. The contract of a driver middleware class is the Driver interface. A class that only implements that interface and not the abstract class is still a valid driver middleware class.

So, even if we did add such a method to AbstractDriverMiddleware, it would not guarantee that you could actually unwrap the whole driver stack.

I don't know what problem you are trying to solve, but I would kindly ask you to find a different way.

@oleg-andreyev
Copy link
Author

Case is mentioned here DamienHarper/auditor#184 and https://github.com/DamienHarper/auditor/blob/8edca5bedfda2f838003471321c60c45d941ba03/src/Provider/Doctrine/Auditing/Event/DoctrineSubscriber.php#L37-L42

this could be a wrong implementation from auditor lib, but it's OCP, we decorate connection/driver to add extra functionality - so imo valid solution to check instance if needed, but because driver/connection could be wrapped by many other decorators logic could be broken, that's why need to rewind or unwrap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants