mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Update many-many-through docs (closes #8290)
This commit is contained in:
parent
36834075df
commit
ef335a8a30
@ -324,7 +324,7 @@ class Team extends DataObject
|
||||
{
|
||||
private static $many_many = [
|
||||
"Supporters" => [
|
||||
'through' => 'TeamSupporter',
|
||||
'through' => TeamSupporter::class,
|
||||
'from' => 'Team',
|
||||
'to' => 'Supporter',
|
||||
]
|
||||
@ -332,8 +332,10 @@ class Team extends DataObject
|
||||
}
|
||||
class Supporter extends DataObject
|
||||
{
|
||||
// Prior to 4.2.0, this also needs to include the reverse relation name via dot-notation
|
||||
// i.e. 'Supports' => Team::class . '.Supporters'
|
||||
private static $belongs_many_many = [
|
||||
"Supports" => "Team",
|
||||
'Supports' => Team::class,
|
||||
];
|
||||
}
|
||||
class TeamSupporter extends DataObject
|
||||
@ -343,8 +345,8 @@ class TeamSupporter extends DataObject
|
||||
];
|
||||
|
||||
private static $has_one = [
|
||||
'Team' => 'Team',
|
||||
'Supporter' => 'Supporter',
|
||||
'Team' => Team::class,
|
||||
'Supporter' => Supporter::class,
|
||||
];
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user