function _taxonomy_edge_attach_subtree in Taxonomy Edge 7
Same name and namespace in other branches
- 8 taxonomy_edge.module \_taxonomy_edge_attach_subtree()
- 6 taxonomy_edge.module \_taxonomy_edge_attach_subtree()
Attach path and children to new parents.
Parameters
integer $vid: Vocabulary ID.
array $tid: Term IDs.
array $parents: Term ID of new parents.
1 call to _taxonomy_edge_attach_subtree()
- _taxonomy_edge_move_subtree in ./
taxonomy_edge.module - Detach path and children from current parent and attach to new parents.
File
- ./
taxonomy_edge.module, line 521 - Optimization of taxonomy data model for SQL performance.
Code
function _taxonomy_edge_attach_subtree($vid, $tid, $parents) {
// Build new parents.
db_query("INSERT INTO {taxonomy_term_edge} (vid, tid, parent, distance)\n SELECT e.vid, e2.tid, e.parent, e.distance + e2.distance + 1 AS distance\n FROM {taxonomy_term_edge} e\n INNER JOIN {taxonomy_term_edge} e2 ON e.tid IN (:parents) AND e2.parent = :tid AND e2.vid = e.vid\n WHERE e.vid = :vid\n ", array(
':tid' => $tid,
':parents' => $parents,
':vid' => $vid,
));
taxonomy_edge_invalidate_order($vid);
}