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:

  1. Instead of fetching the IDs of the children to build of the $orphans variable, use the $child variable directly
  2. Instead of calling entity_delete_multiple() call the delete() 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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tstoeckler created an issue. See original summary.

tstoeckler’s picture

Title: Term::postDelete() calls is needlessly complex » Term::postDelete() is needlessly complex
tstoeckler’s picture

Issue summary: View changes
tstoeckler’s picture

Issue summary: View changes
govind.maloo’s picture

Status: Active » Needs review
tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

That's perfect, thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 5: Term_postDelete-2761059-5.patch, failed testing.

snehi’s picture

Triggering testbot.

tstoeckler’s picture

Title: Term::postDelete() is needlessly complex » Term::postDelete() needlessly uses entity_delete_multiple()
tstoeckler’s picture

Status: Needs work » Needs review

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

arunkumark’s picture

I have created patch for Drupal 8.3.x version.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Perfect, thank you!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 367c98f and pushed to 8.3.x. Thanks!

  • alexpott committed 367c98f on 8.3.x
    Issue #2761059 by govind.maloo, arunkumark, tstoeckler: Term::postDelete...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

xjm’s picture

Correcting credit.