Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8178395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:45:20+00:00 2026-06-06T23:45:20+00:00

I have two tables: tags — id name etc.. tags_synonyms — tag_id syn_id The

  • 0

I have two tables:

tags
---
id
name
etc..

tags_synonyms
---
tag_id
syn_id

The syn_id is the synonym tag’s id, and the tag_id reflects the “root” tag that will actually be used. The synonyms exist only to provide alternative spelling/etc for tags to reference and find the root tag through. (please correct me if they should be stored in a separate table)

So I created a model Tag in Yii, but I’m not sure how to setup the relationships for it.

What I want to be able to do is do:
$tag->synonyms, and $tag->root to grab all synonyms and the one root tag respectively.

How would I setup the relationships for these two things?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:45:21+00:00Added an answer on June 6, 2026 at 11:45 pm

    I ended up just adding a linked_to root word column to the tags table and using that to reference the main word from the synonyms.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, one is 'tags' that stores tid (auto increment) and name
I have two tables. table_x: id INT(11) tag INT(11) table_tags: id INT(11) name VARCHAR(255)
I have two tables linked together through the 3rd table threads: id, name tags:
I have two tables : products and tags. products key | name | description
I have two tables with these structure: articles: article_id, text tags: tag_id, article_id, text
I have a database that contains two tables: entries tags The entries table contains
I've got two tables (articles and tags) that have a one-to-many relationship. I remember
I have two tables: photos (id,path) and tags(id,name) . Tables are in many-to-many relationship,
Let's say, I have two tables, entities and tags. Relation between them is expressed
I have two tables one with ID and NAME table 1 ID | NAME

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.