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.
API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21State%21S...
State::delete()
calls parent::delete()
, and then State::deleteMultiple()
, which then calls parent::delete()
for each of the received keys.
State::delete()
should just calls State::deleteMultiple()
, and the code would become the following.
public function delete($key) {
$this->deleteMultiple([$key]);
}
Comment | File | Size | Author |
---|---|---|---|
#14 | remove-parent-delete-2884223-14.patch | 425 bytes | apaderno |
#8 | remove-parent-delete-2884223-8.patch | 425 bytes | apaderno |
#6 | remove-parent-delete-2884223-6.patch | 397 bytes | apaderno |
#4 | remove-parent-delete-2884223-4.patch | 406 bytes | apaderno |
#2 | remove-parent-delete-2884223-2.patch | 404 bytes | apaderno |
Comments
Comment #2
apadernoComment #4
apadernoMoving the file from Ubuntu, I lost a new line.
Comment #6
apadernoComment #7
apadernoIt makes more sense to simply change the code as follows.
It doesn't make sense to call
$this->deleteMultiple([$key])
, which needs to loop over an array containing a single item, just to avoid calling$this->keyValueStore->delete($key)
directly.Comment #8
apadernoComment #9
Dinesh18 CreditAttribution: Dinesh18 as a volunteer commentedI looked into both the delete and deleteMultiple API page. If you will look into the deleteMultiple , they have just used foreach for keys. So, for delete we just need to remove the foreach and rest remains the same.
#8 looks great to me. Changing the status to RTBC.
Comment #10
Wim LeersClarifying title.
Comment #11
larowlanLooks good to me
Comment #13
catchCommitted a75874b and pushed to 8.4.x. Thanks!
Comment #14
apadernoShould I provide the patch also for previous versions?
Comment #15
Dinesh18 CreditAttribution: Dinesh18 as a volunteer commentedPatch #14 looks good to me.
Changing the status to RTBC.
Comment #16
Gábor HojtsyI think if @catch intended to cherry-pick to Drupal 8.3.x, he would have. I don't think it does harm to cherry-pick neither it does harm to not, so going to move this back to 8.4.x fixed. Thanks for providing the patch either way!