1
0
mirror of synced 2025-01-18 14:31:40 +03:00

important hint about which columns local and foreign refer to in Many-To-Many relationships

Ticket: 538
This commit is contained in:
chris 2007-10-29 23:34:09 +00:00
parent 13f2ea77d9
commit 2125718d30

View File

@ -181,8 +181,8 @@ class User extends Doctrine_Record
{ {
public function setUp() public function setUp()
{ {
$this->hasMany('Group', array('local' => 'user_id', $this->hasMany('Group', array('local' => 'user_id', // <- these are the column names
'foreign' => 'group_id', 'foreign' => 'group_id', // <- in the association table
// the following line is needed in many-to-many relations! // the following line is needed in many-to-many relations!
'refClass' => 'GroupUser')); 'refClass' => 'GroupUser'));
@ -196,8 +196,8 @@ class User extends Doctrine_Record
class Group extends Doctrine_Record class Group extends Doctrine_Record
{ {
public function setUp() { public function setUp() {
$this->hasMany('User', array('local' => 'group_id', $this->hasMany('User', array('local' => 'group_id', // <- these are the column names
'foreign' => 'user_id', 'foreign' => 'user_id', // <- in the association table
// the following line is needed in many-to-many relations! // the following line is needed in many-to-many relations!
'refClass' => 'GroupUser')); 'refClass' => 'GroupUser'));
} }