public function add_child(Model_Comment $child) { $children = (array) $this->get('children'); $orphans = (array) $this->get('orphans'); if ($child->get('parent') != $this->get_id()) { $orphans[$child->get_id()] = $child; } else { $children[$child->get_id()] = $child; } $this->search_parents($children, $orphans); $this->set('children', $children); $this->set('orphans', $orphans); }