protected function attach_nodes_to_categories() {
        foreach ($this->nodes as $node) {
            $parentcat = $node->parentcat;
            if (!isset($this->categories[$parentcat])) {
                throw new \coding_exception("Category $parentcat doesn't exist");
            } else {
                $this->categories[$parentcat]->add_node($node);
            }
        }
    }
protected function attach_nodes_to_categories() {
        foreach ($this->nodes as $node) {
            $parentcat = $node->parentcat;
            if (!isset($this->categories[$parentcat])) {
                throw new \coding_exception("Category $parentcat doesn't exist");
            } else {
                $this->categories[$parentcat]->add_node($node);
            }
        }
    }
protected function attach_nodes_to_categories ( ) { foreach ( $ this -> nodes as $ node ) { $ parentcat = $ node -> parentcat ; if ( ! isset ( $ this -> categories [ $ parentcat ] ) ) { throw new \ coding_exception ( "Category $parentcat doesn't exist" ) ; } else { $ this -> categories [ $ parentcat ] -> add_node ( $ node ) ; } } }
Attach various nodes to their respective categories.

@throws \coding_exception
Attach various nodes to their respective categories .