コード例 #1
0
 public function setTagsAsString($tagString)
 {
     $c = new Criteria();
     $c->add(sfSimpleBlogTagPeer::SF_BLOG_POST_ID, $this->getId());
     sfSimpleBlogTagPeer::doDelete($c);
     $tags = explode(',', $tagString);
     foreach ($tags as $tag) {
         if (!$tag) {
             continue;
         }
         $tagObject = new sfSimpleBlogTag();
         $tagObject->setTag($tag);
         $tagObject->setSfBlogPostId($this->getId());
         $tagObject->setSfSimpleBlogPost($this);
         $tagObject->save();
     }
 }
コード例 #2
0
 public static function retrieveByPK($sf_blog_post_id, $tag, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(sfSimpleBlogTagPeer::SF_BLOG_POST_ID, $sf_blog_post_id);
     $criteria->add(sfSimpleBlogTagPeer::TAG, $tag);
     $v = sfSimpleBlogTagPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
 public function executeTagList()
 {
     $this->tags = sfSimpleBlogTagPeer::getTagsWithCount();
 }