Change record status: 
Project: 
Introduced in branch: 
8.0.x
Introduced in version: 
8.0-alpha15
Description: 

The following functions were removed in favour of OO equivalents.

  • taxonomy_term_load_parents()
  • taxonomy_term_load_parents_all()
  • taxonomy_term_load_children()
  • taxonomy_get_tree()

In addition

  • TermStorageInterface::loadParents() and TermStorageInterface::loadChildren() now return Term objects instead of an array of tids.
  • TermStorageInterface::loadTree() now returns an array of all term objects in the tree. Each term object is extended to have "depth" and "parents" attributes in addition to its normal ones (aka the original return of taxonomy_get_tree()).
  • New method TermStorageInterface::loadAllParents().
Drupal 7 Drupal 8
  $parents = taxonomy_term_load_parents($tid);
  // Procedural code - for OO code, inject the TermStorage object.
  $parents = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadParents($tid);
  $parents = taxonomy_term_load_parents_all($tid);
  // Procedural code - for OO code, inject the TermStorage object.
  $parents = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadAllParents($tid);
  $children = taxonomy_term_load_children($tid);
  // Procedural code - for OO code, inject the TermStorage object.
  $children = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadChildren($tid);
  $tree = taxonomy_get_tree($vid, $parent, $max_depth, $load_entities);
  // Procedural code - for OO code, inject the TermStorage object.
  $tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid, $parent, $max_depth, $load_entities);
Impacts: 
Module developers