From addfa45d3aada1a268ff4e13276c17d3bb9e2f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Mon, 4 Mar 2019 08:52:07 +0100 Subject: [PATCH] hasMany(_:through:using:) --- .../Association/HasManyThroughAssociation.swift | 5 +++-- Tests/GRDBTests/AssociationHasManyThroughSQLTests.swift | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/GRDB/QueryInterface/Association/HasManyThroughAssociation.swift b/GRDB/QueryInterface/Association/HasManyThroughAssociation.swift index 35c5eecdb..aa4613ab6 100644 --- a/GRDB/QueryInterface/Association/HasManyThroughAssociation.swift +++ b/GRDB/QueryInterface/Association/HasManyThroughAssociation.swift @@ -19,8 +19,9 @@ extension HasManyThroughAssociation: TableRequest where Destination: TableRecord extension TableRecord { public static func hasMany( - _ target: Target, - through pivot: Pivot) + _ destination: Target.RowDecoder.Type, + through pivot: Pivot, + using target: Target) -> HasManyThroughAssociation where Pivot: Association, Target: Association, diff --git a/Tests/GRDBTests/AssociationHasManyThroughSQLTests.swift b/Tests/GRDBTests/AssociationHasManyThroughSQLTests.swift index 9c53aea4d..e26a0a76b 100644 --- a/Tests/GRDBTests/AssociationHasManyThroughSQLTests.swift +++ b/Tests/GRDBTests/AssociationHasManyThroughSQLTests.swift @@ -14,7 +14,7 @@ class AssociationHasManyThroughSQLTests: GRDBTestCase { func testBelongsToHasMany() throws { struct A: MutablePersistableRecord { static let b = belongsTo(B.self) - static let c = hasMany(B.c, through: b) + static let c = hasMany(C.self, through: b, using: B.c) func encode(to container: inout PersistenceContainer) { container["bId"] = 1 } @@ -54,7 +54,7 @@ class AssociationHasManyThroughSQLTests: GRDBTestCase { func testHasOneHasMany() throws { struct A: MutablePersistableRecord { static let b = hasOne(B.self) - static let c = hasMany(B.c, through: b) + static let c = hasMany(C.self, through: b, using: B.c) func encode(to container: inout PersistenceContainer) { container["id"] = 1 } @@ -94,7 +94,7 @@ class AssociationHasManyThroughSQLTests: GRDBTestCase { func testHasManyBelongsTo() throws { struct A: MutablePersistableRecord { static let b = hasMany(B.self) - static let c = hasMany(B.c, through: b) + static let c = hasMany(C.self, through: b, using: B.c) func encode(to container: inout PersistenceContainer) { container["id"] = 1 } @@ -134,7 +134,7 @@ class AssociationHasManyThroughSQLTests: GRDBTestCase { func testHasManyHasOne() throws { struct A: MutablePersistableRecord { static let b = hasMany(B.self) - static let c = hasMany(B.c, through: b) + static let c = hasMany(C.self, through: b, using: B.c) func encode(to container: inout PersistenceContainer) { container["id"] = 1 }