important hint about which columns local and foreign refer to in Many-To-Many relationships
Ticket: 538
This commit is contained in:
parent
13f2ea77d9
commit
2125718d30
@ -181,8 +181,8 @@ class User extends Doctrine_Record
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
$this->hasMany('Group', array('local' => 'user_id',
|
||||
'foreign' => 'group_id',
|
||||
$this->hasMany('Group', array('local' => 'user_id', // <- these are the column names
|
||||
'foreign' => 'group_id', // <- in the association table
|
||||
// the following line is needed in many-to-many relations!
|
||||
'refClass' => 'GroupUser'));
|
||||
|
||||
@ -196,8 +196,8 @@ class User extends Doctrine_Record
|
||||
class Group extends Doctrine_Record
|
||||
{
|
||||
public function setUp() {
|
||||
$this->hasMany('User', array('local' => 'group_id',
|
||||
'foreign' => 'user_id',
|
||||
$this->hasMany('User', array('local' => 'group_id', // <- these are the column names
|
||||
'foreign' => 'user_id', // <- in the association table
|
||||
// the following line is needed in many-to-many relations!
|
||||
'refClass' => 'GroupUser'));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user