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 = [
|
private static $many_many = [
|
||||||
"Supporters" => [
|
"Supporters" => [
|
||||||
'through' => 'TeamSupporter',
|
'through' => TeamSupporter::class,
|
||||||
'from' => 'Team',
|
'from' => 'Team',
|
||||||
'to' => 'Supporter',
|
'to' => 'Supporter',
|
||||||
]
|
]
|
||||||
@ -332,8 +332,10 @@ class Team extends DataObject
|
|||||||
}
|
}
|
||||||
class Supporter 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 = [
|
private static $belongs_many_many = [
|
||||||
"Supports" => "Team",
|
'Supports' => Team::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
class TeamSupporter extends DataObject
|
class TeamSupporter extends DataObject
|
||||||
@ -343,8 +345,8 @@ class TeamSupporter extends DataObject
|
|||||||
];
|
];
|
||||||
|
|
||||||
private static $has_one = [
|
private static $has_one = [
|
||||||
'Team' => 'Team',
|
'Team' => Team::class,
|
||||||
'Supporter' => 'Supporter',
|
'Supporter' => Supporter::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user