Example #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTags()
 {
     return $this->hasMany(Tag::className(), ['id' => 'tag_id'])->viaTable('post_has_tag', ['post_id' => 'id']);
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTag()
 {
     return $this->hasOne(Tag::className(), ['id' => 'tag_id']);
 }