From ef335a8a30b5c9612bec52dbfd151da8f1d483f4 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Fri, 27 Jul 2018 09:30:13 +0100 Subject: [PATCH] Update many-many-through docs (closes #8290) --- docs/en/02_Developer_Guides/00_Model/02_Relations.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/en/02_Developer_Guides/00_Model/02_Relations.md b/docs/en/02_Developer_Guides/00_Model/02_Relations.md index d33c3276e..5f0ff2e04 100644 --- a/docs/en/02_Developer_Guides/00_Model/02_Relations.md +++ b/docs/en/02_Developer_Guides/00_Model/02_Relations.md @@ -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, ]; } ```