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

Deprecate VersionAwarePlatformDriver and ServerInfoAwareConnection #4751

Merged

Conversation

morozov
Copy link
Member

@morozov morozov commented Aug 24, 2021

Q A
Type deprecation
BC Break no

Currently, there are two ways the wrapper Connection can instantiate an AbstractPlatform:

  1. If the driver is VersionAwarePlatformDriver, use:
    return $this->_driver->createDatabasePlatformForVersion($version);
  2. Otherwise, fall back to:
    return $this->_driver->getDatabasePlatform();

Although these two approaches are mutually exclusive, version-aware drivers have to implement both methods. Additionally, there is an assumption that the driver connection used by all VersionAwarePlatformDrivers is ServerInfoAwareConnection which isn't enforced statically and requires runtime type checks assertions.

Whether or not the driver instantiates a platform based on the server version should be considered an implementation detail which may change when the support of a new platform version is added or removed. For instance, as of #3756, the SQL Server drivers do not use the server version to instantiate the platform but the connection is still declared as aware of the server version.

This detail doesn't need to be exposed outside of the driver and doesn't deserve an API.

Copy link
Member

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

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

Are there easy ways to write tests for this?

src/Connection.php Outdated Show resolved Hide resolved
@morozov morozov force-pushed the deprecate-server-info-aware-connection branch from 77847af to 7b2a322 Compare August 25, 2021 18:09
@morozov morozov requested a review from greg0ire August 25, 2021 20:19
@morozov morozov merged commit b46a318 into doctrine:3.2.x Aug 25, 2021
@morozov morozov deleted the deprecate-server-info-aware-connection branch August 25, 2021 21:14
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants