-
Notifications
You must be signed in to change notification settings - Fork 14
HasManyRelationship
Josh Wright edited this page Jan 14, 2021
·
4 revisions
Either side of a M - M relationship or the parent of a 1 - M
relationship. The details of this relationship are defined
in the initializers inherited from HasRelationship
.
@propertyWrapper public final class HasManyRelationship<From: Model, To: ModelMaybeOptional>: HasRelationship<From, To>, Encodable, Relationship
Encodable
, HasRelationship<From, To>
, Relationship
public required init(propertyName: String? = nil, to key: KeyPath<To.Value, To.Value.BelongsTo<From>>, keyString: String = To.Value.keyMappingStrategy.map(input: "\(From.self)Id"))
public required init<Through: Model>(propertyName: String? = nil, from fromKey: KeyPath<Through, Through.BelongsTo<From.Value>>, to toKey: KeyPath<Through, Through.BelongsTo<To.Value>>, fromString: String = Through.keyMappingStrategy.map(input: "\(From.self)Id"), toString: String = Through.keyMappingStrategy.map(input: "\(To.Value.self)Id"))
public required init(from decoder: Decoder) throws
The related [Model]
object. Accessing this will fatalError
if the relationship is not already loaded via eager loading
or set manually.
var wrappedValue: [To]
The projected value of this property wrapper is itself. Used for when a reference to the relationship type is needed, such as during eager loads.
var projectedValue: From.HasMany<To>
public func loadRelationships(for from: [From], query nestedQuery: @escaping (ModelQuery<To.Value>) -> ModelQuery<To.Value>, into eagerLoadKeyPath: KeyPath<From, From.HasMany<To>>) -> EventLoopFuture<[From]>
public func encode(to encoder: Encoder) throws
Generated at 2021-01-13T22:24:59-0800 using swift-doc 1.0.0-beta.5.
Alchemy
Types
- AlterTableBuilder
- BCryptDigest
- BasicAuthMiddleware
- BcryptError
- BelongsToRelationship
- CORSMiddleware
- CORSMiddleware.AllowOriginSetting
- CORSMiddleware.Configuration
- ColumnType
- CreateColumn
- CreateColumnBuilder
- CreateIndex
- CreateTableBuilder
- DatabaseConfig
- DatabaseError
- DatabaseField
- DatabaseKeyMappingStrategy
- DatabaseValue
- DayUnit
- Env
- FrequencyTyped
- Grammar
- HTTPAuth
- HTTPAuth.Basic
- HTTPAuth.Bearer
- HTTPBody
- HTTPError
- HasManyRelationship
- HasOneRelationship
- HasRelationship
- HourUnit
- JoinClause
- JoinType
- Launch
- Log
- MIMEType
- MinuteUnit
- ModelQuery
- MySQLDatabase
- Operator
- OrderClause
- OrderClause.Sort
- OrderedDictionary
- PapyrusClientError
- PathParameter
- PathParameter.DecodingError
- PostgresDatabase
- Query
- Request
- Response
- Router
- RuneError
- SQL
- SQLJSON
- Scheduler
- Schema
- SecondUnit
- Services
- Socket
- StaticFileMiddleware
- StringLength
- Thread
- TokenAuthMiddleware
- WeekUnit
- Weekday
- WhereBoolean
- WhereColumn
- WhereIn
- WhereIn.InType
- WhereNested
- WhereRaw
- WhereValue