/** * 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; }
/** */ public function remove($blogEntryID) { //First delete from the blog entry. $where = $this->quoteInto('id = ?', $blogEntryID); $this->delete($where); //Delete all associations with the blogentry $blogEntryTagMap = new Datasource_Cms_Connect_BlogEntryTagMap(); $blogEntryTagMap->removeAllMaps($blogEntryID); }