HasOneThrough<R extends Model> class final

hasOneThrough: like HasManyThrough but a single model (or null).

Inheritance

Constructors

HasOneThrough(ModelDefinition<R> related(), {required ModelDefinition<Model> through(), required String firstKey, required String secondKey, String localKey = 'id', String secondLocalKey = 'id'})

Properties

firstKey → String
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
localKey → String
finalinherited
matchColumns → List<String>
The related rows' columns this relation matches them on (its foreign or owner key): added back when an eager load selects columns without them (with_('user:name') still reads users.id).
no setterinherited
name ↔ String
Name under which the relation is registered (set by the definition).
getter/setter pairinherited
parentColumns → List<String>
The parent rows' columns this relation reads (its local or foreign key): added to a parent query that selects columns without them, so the relation can still be loaded from its rows.
no setterinherited
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
secondKey → String
finalinherited
secondLocalKey → String
finalinherited
through → ModelDefinition<Model> Function()
finalinherited

Methods

correlated(ModelDefinition<Model> parent, DatabaseManager db) → ModelQuery<R>
A query on the related table correlated with the parent table, for whereHas / withCount.
inherited
eagerLoad(List<Model> parents, DatabaseManager db, [RelationConstraint? constraint]) → Future<void>
Loads the relation for many parents in one batched query and stores the result on each parent under name.
override
existenceQuery(ModelDefinition<Model> parent, DatabaseManager db, {required String parentTable}) → ModelQuery<R>
correlated against the parent table as parentTable names it (an alias inside a self-relation subquery). The built-in relations alias their own table when it has the parent's name (categories whose children are categories); custom relations fall back to correlated.
inherited
loadedModels(List<Model> parents) → List<Model>
The models loaded under name on parents, flattened (for nested eager loading).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queryFor(Model parent, DatabaseManager db) → ModelQuery<R>
Query returning the related models of one parent.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited