Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Deprecate Drupal\Core\Database\StatementEmpty as it only is used in testing and therefore does not belong in the main namespace.
Proposed resolution
Deprecate Drupal\Core\Database\StatementEmpty and replace where it is used. For pure testing, StatementInterface could be mocked to return empty values.
Remaining tasks
TBD
User interface changes
None
API changes
The class Drupal\Core\Database\StatementEmpty will be deprecated.
Data model changes
None
Release notes snippet
TBD
Issue fork drupal-3186795
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
daffie CreditAttribution: daffie commentedPostponed on #3177660: Remove public properties from StatementInterface implementations.
Comment #3
daffie CreditAttribution: daffie commentedComment #4
donquixote CreditAttribution: donquixote as a volunteer commentedInteresting.
#3195524: $query->execute() should throw exception on failure, not return NULL
Here I suggest the opposite: Use StatementEmpty as a return value for select queries where we can determine the result to be empty before running the actual query.
(thanks @mondrake for linking)
Comment #7
mondrakeIMHO it's not necessary to wait on #3177660: Remove public properties from StatementInterface implementations.
Comment #8
mondrakeRerolled
Comment #9
mondrakeMaybe we can just return NULL from ::queryRange of test drivers, that makes the entire class dead code.
Comment #10
mondrakeI do not think this is minor.
Comment #11
daffie CreditAttribution: daffie commentedAll the code changes llok good to me.
The class StatementEmpty has a deprecation and it is tested.
I have updated the CR.
For me it is RTBC.
Comment #12
catchNice clean-up.
Committed c72c953 and pushed to 9.2.x. Thanks!
Comment #14
catch