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

Address deprecations from doctrine/dbal #11809

Draft
wants to merge 7 commits into
base: 3.3.x
Choose a base branch
from

Conversation

greg0ire
Copy link
Member

No description provided.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@morozov am I on the right track with this? It seems a bit complicated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand, you want to create wrapper classes that will expose some unified interface for DBAL 4 and 5. That looks about right.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a second thought, is it really necessary for ORM to support DBAL 4.2.x and 5.x? If it bumps DBAL requirement to 4.3.x, then it can switch to the new API without the need to implement the wrapers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue isn't that 4.2.x needs to be supported (otherwise indeed I would bump), the issue is that 3.x needs to be supported 😢

Copy link
Member

@morozov morozov Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's something fundamentally wrong with this requirement.

DBAL deprecates its old APIs and provides a forward compatibility layer exactly in order to help its consumers migrate from one major release to the other (two in total) w/o building any compatibility layers themselves. ORM, on the other hand, aims at supporting 3 major DBAL releases (3 through 5) and thus has to maintain its own compatibility layer.

Maybe instead of building a compatibility layer, this effort could be spent on dropping support for DBAL 3?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that @derrabus has done this: #11216

@derrabus should it be backported or what?

$namesAsStrings = [];

foreach ($this->foreignKey->getReferencingColumnNames() as $name) {
$namesAsStrings[] = $name->toSQL($platform);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I maybe be using toString here? I fear that the platform won't be always available in places where I should use these methods, for instance here:

$localColumn = current($myFk->getLocalColumns());

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to represent names as strings for compatibility with DBAL 4, then toString() is fine. The contract is: toSQL(AbstractPlatform) will render the name so that it can be parsed by the platform in question; toString() will render the name so that it can be parsed by the corresponding name parser (i.e. converted back to object).

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

Successfully merging this pull request may close these issues.

2 participants