From 45ff5f2fa190713fa3c5546f8e8b41e5eb572141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 30 Sep 2018 13:23:35 +0200 Subject: [PATCH] One less known issue with associations :-) --- Documentation/AssociationsBasics.md | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/Documentation/AssociationsBasics.md b/Documentation/AssociationsBasics.md index cc0c29102..b70936767 100644 --- a/Documentation/AssociationsBasics.md +++ b/Documentation/AssociationsBasics.md @@ -1442,26 +1442,6 @@ let request = Book This code compiles, but you'll get a runtime fatal error "Not implemented: chaining a required association behind an optional association". Future versions of GRDB may allow such requests. -**You can't join two associations with the same [association key](#the-structure-of-a-joined-request) at the same level:** - -```swift -// NOT IMPLEMENTED -let request = Book - .including(required: Book.author) // key "author" - .including(required: Book.author) // key "author" -``` - -This code compiles, but you'll get a runtime fatal error "The association key `author` is ambiguous. Use the Association.forKey(_:) method is order to disambiguate.". Future versions of GRDB may allow such requests. - -To join the same table twice, and make sure GRDB does not modify the fetched results in some future release, make sure no two associations have the same name on a given level: - -```swift -// OK -let request = Book - .including(required: Book.author.forKey("firstAuthor")) - .including(required: Book.author.forKey("secondAuthor")) -``` - ## Future Directions