function addTopicTag($topic_id, $reference_string, $bible_code = 'kjv', $relevant_words = '') { # Add tag object $tag_object = addTag($reference_string, $bible_code, $relevant_words); # Add topic tag object (if applicable) if ($tag_object) { $topic_tag_object = new TopicTag(); $topic_tag_object->setTopicId($topic_id)->setTag($tag_object)->save(); } }
/** * @return \yii\db\ActiveQuery */ public function getTopicTags() { return $this->hasMany(TopicTag::className(), ['tag_id' => 'id']); }