EntityRelation constructor
EntityRelation({})
Implementation
EntityRelation({
required this.localPropNames,
this.junctions = const [],
this.foreignTableName,
required this.foreignPropNames,
}) {
if (junctions.isEmpty) {
if (localPropNames.length != foreignPropNames.length) {
throw ArgumentError(
'Database keys have inconsistent number of columns.');
}
} else {
if (localPropNames.length != junctions.first.localPropNames.length) {
throw ArgumentError(
'Database keys have inconsistent number of columns.');
}
var previousAssociation = junctions.first;
for (var association in junctions.skip(1)) {
if (association.localPropNames.length !=
previousAssociation.foreignPropNames.length) {
throw ArgumentError(
'Database keys have inconsistent number of columns.');
}
previousAssociation = association;
}
if (foreignPropNames.length !=
previousAssociation.foreignPropNames.length) {
throw ArgumentError(
'Database keys have inconsistent number of columns.');
}
}
}