Problem/Motivation
The values returned by ::execute() DML methods (INSERT, UPDATE, UPSERT, DELETE, MERGE) and from the TRUNCATE DDL method are inconsistent and fragile.
See discussions in #3567868: \Drupal\Core\Database\Query\Update::execute has wrong documentation for return type and #2547493: Add support for unique / primary key constraints composed of multiple fields for Upsert queries.
Proposed resolution
Change those classes execute methods not to return values, typehint them to void, where possible and solid provide additional methods that return details of the DML execution.
Remaining tasks
Discuss BC implications; then the rest of things.
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3568486
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:
- 3568486-change-return-of
changes, plain diff MR !14429
Comments
Comment #2
chi commentedI would remove return type from
TRUNCATEmethod as well.Comment #4
mondrake#2 good point, added to the IS.
Comment #5
mondrakeBuilt MR 14429 on top of an MR from #3567868: \Drupal\Core\Database\Query\Update::execute has wrong documentation for return type. Let's see how much we fail.
Comment #6
ghost of drupal pastThis is not necessary. We have solid affected rows support everywhere. Yes in upsert too see my comments there.
Comment #7
mondrakeComment #9
mondrakeBC is complicated, because of the way consuming code is handling the returned value. I will try in child issues to introduce a new
::executeSafe()method typehintedvoid, and deprecate::execute().