Commit 2125718d authored by chris's avatar chris

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

Ticket: 538
parent 13f2ea77
...@@ -181,8 +181,8 @@ class User extends Doctrine_Record ...@@ -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 ...@@ -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'));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment