JamesBarnsley
(Jamesbarnsleyfreelance)
January 12, 2012, 4:29pm
1
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.
jacmoe
(Jacob Moen)
January 12, 2012, 4:32pm
2
[color="#006400 "]/* Moved from Yii Powered Applications to Yii 1.1 Help forum */[/color]
tri
(tri - Tommy Riboe)
January 12, 2012, 6:07pm
4
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
tri
(tri - Tommy Riboe)
January 12, 2012, 7:27pm
6
Explain why you think so. Did you try this out? I did.
/Tommy