findForeignField method

FieldElement findForeignField(
  1. OrmBuildContext ctx
)

Implementation

FieldElement findForeignField(OrmBuildContext ctx) {
  var foreign = throughContext ?? this.foreign!;
  return foreign.effectiveFields.firstWhere(
      (f) => foreign.buildContext.resolveFieldName(f.name) == foreignKey,
      orElse: () {
    throw '${foreign.buildContext.clazz.name} has no field that maps to the name "$foreignKey", '
        'but ${ctx.buildContext.clazz.name} has a @HasMany() relation that expects such a field.';
  });
}