withRelationsFrom method

TableRelationBuilder withRelationsFrom(
  1. List<BuilderRelation> relations
)

In iteration order, adds relations from the relation list using the relation aliases.

Uses the ID column as key for the relation on both sides for the tables.

Implementation

TableRelationBuilder withRelationsFrom(List<BuilderRelation> relations) {
  var firstRelation = relations.first;
  var table = firstRelation.table;
  var relationAlias = firstRelation.relationAlias;

  for (var relation in relations.skip(1)) {
    _addRelationBetween(table, relation.table, relationAlias);
    table = relation.table;
    relationAlias = relation.relationAlias;
  }

  _addRelationBetween(table, _table, relationAlias);

  return this;
}