public function getByTagId($tagId) { $map = new Datasource_Cms_Connect_BlogEntryTagMap(); $mapArray = $map->getByTagId($tagId); $returnArray = array(); foreach ($mapArray as $currentMap) { $returnArray[] = $this->getByID($currentMap['blog_entry_id']); } //Provide a return value consistent with this function's contract. if (empty($returnArray)) { $returnVal = null; } else { $returnVal = $returnArray; } return $returnVal; }
/** * Returns an array of blog entries associated with the tag string passed in. * * @param string $tagName * The name of the tag against which this method will try to find * associated blog entries. * * @return mixed * Returns an array of blog entries associated with the tag name * passed in, or null if there are no associated blog entries. */ public function getBlogEntriesByTagName($tagName) { $blogEntryTags = new Datasource_Cms_Connect_BlogEntryTags(); $tagId = $blogEntryTags->getID($tagName); //Now get all the blog entries associated with that tag id. $blogEntryTagMap = new Datasource_Cms_Connect_BlogEntryTagMap(); $blogEntryDetails = $blogEntryTagMap->getByTagId($tagId); $returnArray = array(); if (!empty($blogEntryDetails)) { $blogEntries = new Datasource_Cms_Connect_BlogEntries(); foreach ($blogEntryDetails as $currentBlogEntry) { $returnArray[] = $blogEntries->getByID($currentBlogEntry->blog_entry_id); } } //Provide a return value consistent with this function's contract. if (empty($returnArray)) { $returnVal = null; } else { $returnVal = $returnArray; } return $returnVal; }