E
E
Evgeny Bukharev2015-05-07 12:57:25
Yii
Evgeny Bukharev, 2015-05-07 12:57:25

How to implement such a connection in Yii?

Good afternoon,
There are three models: offers, users and companies.
Users are linked to companies via company_id in the users table
Offers are linked to users via user_id in the offer table
How can an offer be linked to a company?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mikhail Osher, 2015-05-07
@miraage

www.yiiframework.com/doc/guide/1.1/en/database.arr...

T
The Dragger, 2015-05-07
@IPD2

The user belongs to the company BELONGS_TO
The company can have several users HAS_MANY
As you need and link it EZ

K
klis, 2015-05-07
@klis

From the description, such a connection already exists through the user. Offer->User->Company

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question