renderResultToEntity method

DfBaseEntity<DfBaseField> renderResultToEntity(
  1. {Map<String, dynamic> pResult}
)

Implementation

DfBaseEntity renderResultToEntity({Map<String,dynamic> pResult}) {
  DfBaseEntity entity;
  if (query != null && query.entityJoin != null && query.entityJoin.entities != null && query.entityJoin.entities.length > 0) {
    entity = query.entityJoin.entities[0];
  }

  Map<String,dynamic> rawResult = singleResult;
  if (pResult != null) {
    rawResult = pResult;
  }

  if (rawResult == null && result != null && result.length > 0)
    rawResult = result[0];

  if (entity != null && rawResult != null) {
    //print("renderResultToEntity rawResult is $rawResult");
    return entity.parseExecRawJsonResultToEntity(query.purpose, Mapper.fromJson(rawResult));
  }
  else {
    print("No renderResultToEntity due to empty of rawResult is $rawResult, entity is $entity");
  }
  return null;
}