getEntityByID<O> method
FutureOr<O?>
getEntityByID<O>(
- dynamic id, {
- Type? type,
- bool sync = false,
- EntityResolutionRules? resolutionRules,
override
Implementation
@override
FutureOr<O?> getEntityByID<O>(dynamic id,
{Type? type, bool sync = false, EntityResolutionRules? resolutionRules}) {
if (id == null || type == null) return null;
var entityRepository = getEntityRepositoryByType(type);
if (entityRepository != null) {
if (sync) return null;
return entityRepository
.selectByID(id, resolutionRules: resolutionRules)
.resolveMapped((o) => o as O?);
}
var enumReflection = ReflectionFactory().getRegisterEnumReflection(type);
if (enumReflection != null) {
return null;
}
_log.warning(
"Can't get entity by ID($id). Can't find `EntityRepository` for type: $type @ $this");
return null;
}