fix: #3618696 Commit transactions explicitly instead of letting them go out-of-scope

Commits the two transactions explicitly instead of relying on the Transaction object going out of scope, which core deprecated in 11.5 and removes in 13.0.

  • WebformEntityStorage::getSerial()
  • WebformSubmissionStorage::resave()

Transaction::commitOrRelease() only exists from Drupal 11.3 and this branch supports ^10.3 || ^11, so the call is guarded with method_exists(). Where the method is absent the existing end-of-scope commit still applies and raises no deprecation on that core version, so behaviour is unchanged there. Same guard shape as [#3618674].

Two notes:

  • The rollBack() in resave()'s catch block is kept. An out-of-scope Transaction commits rather than rolls back, so it was never redundant.
  • getSerial() loses its phpcs:ignore for an unused variable, since the transaction handle is now read.

Verified: applies to released 6.3.0 and clears the deprecation on a Drupal 12 (core dev-main) run of a dependent module's suite, 436 tests, 0 failures, 0 errors, 0 deprecations. Also applies cleanly alongside !807 in either order.

Merge request reports

Loading
Loading