findRelationByParent method
Future<List?>
findRelationByParent({
- required List<
ColumnRelation> relations, - required List<
String> dataIds, - Database? database,
- String? orderParameters,
Implementation
Future<List?> findRelationByParent(
{required List<ColumnRelation> relations,
required List<String> dataIds,
Database? database,
String? orderParameters}) async {
return Future.wait((relations).map((relation) async {
final filters = [
QueryFilter(
attribute: relation.referencedColumn as String,
condition: QueryCondition.In,
value: dataIds)
];
final String? whereParameters = QueryFilter.getWhereParameters(
relation.referencedEntityColumns as List<Column>, filters);
final Database db = database != null ? database : this.database;
final newItem = await findWhereInRelation(
database: db,
entity: relation.referencedEntity as Entity,
columns: relation.referencedEntityColumns as List<Column>,
whereParameters: whereParameters,
orderParameters: orderParameters);
return {
"relation": relation.attributeName,
"referencedColumn": relation.referencedColumn,
"data": newItem
};
}));
}