function getVerseTopicsTagsData($verse_id) { # Get verse topics tags objects $verse_topics_tags_objects = TopicTagQuery::create()->useTagQuery()->filterByVerseId($verse_id)->orderByVoteCount('DESC')->endUse()->find(); # Handle verse topics tags objects $verse_topics_tags_data = []; foreach ($verse_topics_tags_objects as $verse_topic_tag_object) { # Get topic object $verse_topic_object = $verse_topic_tag_object->getTopic(); # Get tag object $verse_tag_object = $verse_topic_tag_object->getTag(); # Append tag data $verse_topics_tags_data[] = ['id' => $verse_topic_tag_object->getId(), 'tag' => ['id' => $verse_tag_object->getId(), 'vote_count' => $verse_tag_object->getVoteCount()], 'topic' => ['id' => $verse_topic_object->getId(), 'name' => $verse_topic_object->getName()]]; } # Return verse tag data return $verse_topics_tags_data; }
function getTopicsTags() { $topics_tags_objects = TopicTagQuery::create()->find(); $topics_tags = []; foreach ($topics_tags_objects as $topic_tag_object) { $topics_tags[$topic_tag_object->getTopicId()][] = $topic_tag_object->getTagId(); } return $topics_tags; }