-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 Abstraction\Result #4291
Deprecate Abstraction\Result #4291
Conversation
So the plan for 4.0 is that |
If this gets merged, then the only change I want to do next is to remove the |
UPGRADE.md
Outdated
@@ -1,5 +1,9 @@ | |||
# Upgrade to 2.11 | |||
|
|||
## Deprecated the usage of Abstraction\Result as Driver\Result | |||
|
|||
The usage of the `Abstraction\Result` as a sub-type of the `Driver\Result` interface is deprecated. |
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.
The usage of the `Abstraction\Result` as a sub-type of the `Driver\Result` interface is deprecated. | |
The usage of the `Abstraction\Result` as a sub-type of the `Driver\Result` interface is deprecated. The interface `Driver\Result` will be removed from `Abstraction\Result` in 3.0. |
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.
The "will be removed" removed wording is a bit confusing: will we also remove the methods or not? Would it make sense to reword it as "the interface X will not extend Y in 3.0"?
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.
Sounds better than my text, yes. 👍
1904e15
to
cf14c61
Compare
cf14c61
to
e90de0c
Compare
@SenseException your request for change is addressed. Although the scope of the PR has changed. Please review. |
Release [2.11.1](https://github.com/doctrine/dbal/milestone/80) 2.11.1 ====== - Total issues resolved: **2** - Total pull requests resolved: **8** - Total contributors: **6** Documentation ------------- - [4299: Link to contributing guide](doctrine#4299) thanks to @greg0ire SQLite,Test Suite,pdo_sqlite ---------------------------- - [4297: Fix ExceptionTest::testConnectionExceptionSqLite() on macOS](doctrine#4297) thanks to @morozov - [4296: Increase indent in definition lists](doctrine#4296) thanks to @greg0ire Deprecation,Prepared Statements ------------------------------- - [4291: Deprecate Abstraction\Result](doctrine#4291) thanks to @morozov BC Fix,Quoting -------------- - [4287: Restore PDOStatement::quote() for backward compatibility](doctrine#4287) thanks to @morozov and @Shahelm BC Fix,Query ------------ - [4286: Fix BC break: QueryBuilder::andWhere() etc. should ignore empty strings](doctrine#4286) thanks to @BenMorel and @infabo Bug,Documentation,Prepared Statements ------------------------------------- - [4285: Fix phpdoc on deprecated functions](doctrine#4285) thanks to @qdequippe Bug,PDO,Prepared Statements --------------------------- - [4173: Fix Third parameter not allowed for PDO::FETCH&doctrine#95;COLUMN](doctrine#4173) thanks to @BenMorel # gpg: Signature made Sun Sep 27 06:35:40 2020 # gpg: using DSA key 1BEDEE0A820BC30D858F9F0C2C3A645671828132 # gpg: Can't check signature: No public key
Problem #1: The wrapper Result methods are effectively documented as
@throws Driver\Exception
In #4019 where the
Result
interfaces were first introduced, the idea was to have theAbstraction\Result
extendDriver\Result
since from the methods and parameters standpoint, the former is currently a superset of the latter.The above didn't take into account exception handling. Specifically, the fact that the
Driver\Exception
is not a sub-type ofException
. It creates the following confusion:Despite the fact that
Result::fetch()
catchesDriver\Exception
from the driver result and only throwsException
, it inherits the@throws Driver\Exception
annotation fromDriver\Result
. It means that the callers ofResult::fetch()
should be able to handleException
despite the fact that it will never be thrown:Problem #2: Adding
fetch*()
anditerate*()
methods to the wrapper Result requires a breaking changeSee #4293. Since the wrapper Result is exposed by the Statement as
Abstraction\Result
interface, making the new methods available to the consumers requires adding them to the interface which is a breaking change.Solution
Unlike the driver level where the interfaces have multiple implementations and are meant for extensibility of the driver layer, the wrapper layer is essentially a set of convenience methods packed into a class which is not meant to have multiple implementations by definition.
The solution is to remove the interface and use the classes directly, similarly to the wrapper
Connection
andStatement
classes.I believe it's acceptable to introduce this deprecation in a patch release of
2.11.x
:2.11.0
, so it's unlikely that there is existing code that relies on this behavior.2.11.x
, we'll have to release2.12.0
or postpone the BC break until4.0
.See the drafted removal PR for
3.0.x
: #4294.