Skip to content

RFC: Remove @internal annotation on methods that could be reused in a wrapper_classand add a setter #6885

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

Open
Crovitche-1623 opened this issue Apr 2, 2025 · 1 comment

Comments

@Crovitche-1623
Copy link

Crovitche-1623 commented Apr 2, 2025

Feature Request

What

  1. Remove @internal on methods in Doctrine\DBAL\Connection that could be reused in wrapper_class
  2. Add the possibility to increment the transactionNestingLevel in a class that extends Doctrine\DBAL\Connection

Why

I'm developping a custom Doctrine\DBAL\Connection (for handling my own custom transaction management) and used the wrapper_class configuration parameter to setup my custom connection.

To do so, I extended the original Doctrine\DBAL\Connection and saw that:

  1. Some methods have the @internal annotation:
    a. convertException
    b. getParams
  2. The transactionNestingLevel property does not have the protected visibility and has no setter.

How

  1. Remove the @internal annotation on convertException and getParams
  2. Create a setter for transactionNestingLevel or change the property visibility to protected
@morozov
Copy link
Member

morozov commented Apr 3, 2025

I think it's okay to make transactionNestingLevel protected (I don't see much sense in adding a setter for it – that would be effectively the same). As for making getParams() non-internal, it's a strict no.

I don't think we have a good API for customizing the behavior of the existing components, and I don't want to put the project in a position where we will be unable to make certain changes because they would break BC.

If you want to implement such an extension, you should use internal APIs and accept the risks that they may change over time. An alternative would be to decompose the wrapper connection into smaller pieces for which we could declare the interfaces that we can support.

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

No branches or pull requests

3 participants
@morozov @Crovitche-1623 and others