Yii Framework Forum: Relations Index From Another Table - Yii Framework Forum

Jump to content

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

Relations Index From Another Table Rate Topic: -----

#1 User is offline   Gessle 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 15-December 12

Posted 31 December 2012 - 07:31 AM

I have designed my database so that I have tables:
driver
-id
driver_negotiation
-id
-driver_id
-base_negotiation_id
base_negotiation
-id
-team_id
-cost
-lenght
team
-id


I have this base negotiation, because I have also other negotiations than just driver. So first question is, if this is wise at all or should I put those cost lenght (etc.) to every negotiation part?

The second question is that I want to have driverNegotiation array indexed with teamIds.

'driverNegotiation' => array(self::HAS_MANY, 'DriverNegotiation', 'driver_id', 'index'=>'driver_id'),


If I put this kind of line to my Driver model I get the driverNegotiation array indexed with driverIds, but can (and how) I get the index (team_id) from base_negotiation table?
0

#2 User is offline   Gessle 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 15-December 12

Posted 01 January 2013 - 02:56 PM

I managed to solve this problem with MANY_MANY relations.
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