Database Relations

Hi,

Say I have the following …

Table 1 - Users

ID

Firstname

Lastname

Table 2 - VenueUserSignUps

user_id

venue_id

signed_up_on

rating

Table 3 - Venue

ID

Address

Number of available seats

Ok so table 1 and table 3 are related using the models MANY TO MANY relation, but how do I get access to the signed_up_on and rating database columns using the relation.

I can get say address by doing …

$user->venues[0]->address

But I cannot get at the columns in table 2, i.e. rating.

[color="#006400"]/* Moved from Yii Powered Applications to Yii 1.1 Help forum */[/color]

Here’s a good article

Saw a reason to verify this.

Intuitively and according to my actual results, in that article




'movie' => array(self::HAS_ONE, 'Movie', 'movie_id'),



should become




'movie' => array(self::BELONGS_TO, 'Movie', 'movie_id'),



Objections?

/Tommy

Depends on actual task, I suppose.

Btw, have a look at through() relations

Explain why you think so. Did you try this out? I did.

/Tommy

Thanks guys.