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
\Drupal\taxonomy\Entity\Term::postDelete()
calls out to entity_delete_multiple()
even though it already gets the respective storage handler - that actually takes care of the deletion in the end - passed in.
Proposed resolution
Use the storage handler directly.
Conrecetely:
- Instead of fetching the IDs of the children to build of the
$orphans
variable, use the$child
variable directly - Instead of calling
entity_delete_multiple()
call thedelete()
method on$storage
passing the$orphans
variable.
Note: This could theoretically go into 8.1.x to limit code divergence, but not sure, so tagging against 8.2.x.
Remaining tasks
Write patch.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#13 | Term_postDelete_remove_entity_delete_multiple_2761059_13.patch | 888 bytes | arunkumark |
#5 | Term_postDelete-2761059-5.patch | 888 bytes | govind.maloo |
Comments
Comment #2
tstoecklerComment #3
tstoecklerComment #4
tstoecklerComment #5
govind.maloo CreditAttribution: govind.maloo as a volunteer commentedadded path to use storage handler directly.
Comment #6
govind.maloo CreditAttribution: govind.maloo as a volunteer commentedComment #7
tstoecklerThat's perfect, thanks!
Comment #9
snehi CreditAttribution: snehi as a volunteer and at Publicis Sapient for Publicis Sapient commentedTriggering testbot.
Comment #10
tstoecklerComment #11
tstoecklerComment #13
arunkumarkI have created patch for Drupal 8.3.x version.
Comment #14
tstoecklerPerfect, thank you!
Comment #15
alexpottCommitted 367c98f and pushed to 8.3.x. Thanks!
Comment #18
xjmCorrecting credit.