public TermStorage::updateTermHierarchy(EntityInterface $term)
Updates terms hierarchy information with the hierarchy trail of it.
Parameters
\Drupal\Core\Entity\EntityInterface $term: Term entity that needs to be added to term hierarchy information.
Overrides TermStorageInterface::updateTermHierarchy
File
- core/modules/taxonomy/src/TermStorage.php, line 105
Class
- TermStorage
- Defines a Controller class for taxonomy terms.
Namespace
Drupal\taxonomy
Code
public function updateTermHierarchy(EntityInterface $term) { $query = $this->database->insert('taxonomy_term_hierarchy') ->fields(array('tid', 'parent')); foreach ($term->parent as $parent) { $query->values(array( 'tid' => $term->id(), 'parent' => (int) $parent->target_id, )); } $query->execute(); }
Please login to continue.