Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Relations Index From Another Table

$
0
0
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?

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>