HasManyThrough<R extends Model> class
hasManyThrough: parent → through (firstKey = parent localKey) →
related (secondKey = through secondLocalKey).
- Inheritance
- Implementers
Constructors
-
HasManyThrough(required ModelDefinition<
Model> through(), required String firstKey, required String secondKey, String localKey = 'id', String secondLocalKey = 'id'})
Properties
- firstKey → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- localKey → String
-
final
-
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 readsusers.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 setteroverride
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- secondKey → String
-
final
- secondLocalKey → String
-
final
-
through
→ ModelDefinition<
Model> Function() -
final
Methods
-
A query on the related table correlated with the parent table, for
whereHas/withCount.override -
eagerLoad(
List< Model> parents, DatabaseManager db, [RelationConstraint? constraint]) → Future<void> -
Loads the relation for many
parentsin 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
parentTablenames it (an alias inside a self-relation subquery). The built-in relations alias their own table when it has the parent's name (categorieswhosechildrenarecategories); custom relations fall back to correlated.override -
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.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- throughKeyAlias → const String