private function collectTagsByChild(Tag $tag, $list) { $list[] = $tag; foreach ($tag->getChildren() as $child) { $list = $this->collectTagsByChild($child, $list); } return $list; }
public function getPrimaryParent() { foreach ($this->getParentRelations() as $parentRelation) { if ($parentRelation->getPrimaryParent()) { return $parentRelation->getParent(); } } // this is a root node; return a (non-saved) ROOT tag $parent = new Tag(); $parent->setName("ROOT"); return $parent; }
private function getAllMetaFor(Tag $tag, $metaList = array()) { foreach ($tag->getProtoMeta() as $meta) { $metaList[] = $meta; } foreach ($tag->getParents() as $ptag) { $metaList = $this->getAllMetaFor($ptag, $metaList); } return $metaList; }