Update many-many-through docs (closes #8290)

This commit is contained in:
Loz Calver 2018-07-27 09:30:13 +01:00
parent 36834075df
commit ef335a8a30
1 changed files with 6 additions and 4 deletions

View File

@ -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,
];
}
```