/** * 插入信息 */ 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(); } } }
/** * 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()); }