Example #1
0
 /**
  * 插入信息
  */
 protected function afterSave()
 {
     //标签更新,无条件判定
     if (0) {
         foreach ($this->getTagArray() as $name) {
             if (($tag = GroupTag::model()->findByAttributes(array('name' => $name))) === null) {
                 $tag = new GroupTag();
                 $tag->name = $name;
                 $tag->save();
             }
             $this->dbConnection->createCommand("INSERT INTO group_topic_tag (tid, tagid) VALUES ({$this->id},{$tag->id})")->execute();
         }
     }
 }
Example #2
0
 /**
  * getGroupTag
  * @author wjh 2014-12-30
  * @param $id
  * @param string $returnType
  * @return mixed
  */
 public static function getGroupTag($id, $returnType = 'array', $data = null)
 {
     $types = empty($data) ? self::getGroupTags() : $data;
     return BCacheHelper::find($id, $types, $returnType, GroupTag::model());
 }