Exemplo n.º 1
0
 /**
  * @brief 编译标签
  * @param string $content 要编译的标签
  * @return string 编译后的标签
  */
 public function tagResolve($content)
 {
     $tagObj = new ITag();
     return $tagObj->resolve($content);
 }
 public function updateTag(ITag $tag, ITag $newTag)
 {
     try {
         $dbHandler = $this->getConnection();
         $sqlQuery = 'UPDATE ' . self::TAGS_TABLE_NAME . ' SET ' . TagManager::KEY_LABEL . ' = :new' . TagManager::KEY_LABEL . ', ' . TagManager::KEY_COLOR . ' = :new' . TagManager::KEY_COLOR . ' WHERE ' . TagManager::KEY_TAGID . ' = :' . TagManager::KEY_TAGID;
         $data = array(TagManager::KEY_TAGID => $tag->getId(), 'new' . TagManager::KEY_LABEL => $newTag->getLabel(), 'new' . TagManager::KEY_COLOR => $newTag->getColor());
         $stmt = $dbHandler->prepare($sqlQuery);
         $stmt->execute($data);
         if ($stmt->rowCount() === 0) {
             throw new EyeTagException('Unable to perform update: no such tag "' . $tag . '" found.');
         }
     } catch (PDOException $e) {
         $this->destroyConnection();
         throw new EyeTagException('An error occured while updating tag "' . $tag . '" from the database.', 0, $e);
     }
     $this->destroyConnection();
 }