/** * Contains tag * * The original string tag logic used in_array to check it. * This function uses doctrine2 arrayCollection contains function instead. * * @param Tag|EmbeddedTag $tagToCheck * @return boolean TRUE if this multimedia_object contained the specified tag, FALSE otherwise. */ public function containsTag($tagToCheck) { foreach ($this->tags as $tag) { if ($tag->getCod() == $tagToCheck->getCod()) { return true; } } return false; }
/** * Returns true if given node is descendant of tag * * @param EmbeddedTag|Tag $tag * * @return bool */ public function isDescendantOf($tag) { if ($tag->getCod() == $this->getCod()) { return false; } return substr($this->getPath(), 0, strlen($tag->getPath())) === $tag->getPath(); }