Yii Framework Forum: Yii Relations() - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii Relations() Rate Topic: -----

#1 User is offline   Jijgee 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 54
  • Joined: 16-June 12

Posted 07 December 2012 - 11:57 AM

Hello, I need help.
I have stage, match, game models. Stage can have many matches, and match have to belongs to only one stage. And match can have many games, game have to belongs to only one match. So the stage have many games.
the realtions I wrote are:
For stage
matches=>array(self::HAS_MANY, 'Stage','stageID'),

For match
games=>array(self::HAS_MANY, 'Match', 'matchID'),

Since stage has many games, is there any to access games from stage model.
The game model has date attribute which indicates when the game is held. The thing I need to do is that I need to find game whose date is close to current time from the all games of stage.
Sorry for my poor english.
0

#2 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 723
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 07 December 2012 - 03:45 PM

take a look at the guide this is coverd nicely in guide here

http://www.yiiframew...en/database.arr
0

#3 User is offline   Jijgee 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 54
  • Joined: 16-June 12

Posted 08 December 2012 - 09:52 AM

View Postalirz23, on 07 December 2012 - 03:45 PM, said:

take a look at the guide this is coverd nicely in guide here

http://www.yiiframew...en/database.arr

Thank you.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users