transformSerialize method
Implementation
Map<String, dynamic> transformSerialize(Map<String, dynamic> map,
{bool withRelationships = true}) {
for (final e in relationshipMetas.entries) {
final key = e.key;
if (withRelationships) {
final ignored = e.value.serialize == false;
if (ignored) map.remove(key);
if (map[key] is HasMany) {
map[key] = (map[key] as HasMany).keys;
} else if (map[key] is BelongsTo) {
map[key] = map[key].key;
}
if (map[key] == null) map.remove(key);
} else {
map.remove(key);
}
}
return map;
}