Improve fflib_SObjects2.getSObjectsByIdField
Add unit-test and method to domain template Signed-off-by: WimVelzeboer <wimvelzeboer@protonmail.com>
This commit is contained in:
@@ -27,6 +27,17 @@ public inherited sharing class ${NAME}
|
||||
return new ${NAME}(getRecords(ids));
|
||||
}
|
||||
|
||||
private I${NAME} get${NAME}ByIdField(Schema.SObjectField sObjectField)
|
||||
{
|
||||
Map<Id, List<SObject>> sObjectsById = getSObjectsById(sObjectField);
|
||||
Map<Id, I${NAME}> result = new Map<Id, I${NAME}>();
|
||||
for (Id idValue : sObjectsById.keySet())
|
||||
{
|
||||
result.put(idValue, new ${NAME}(sObjectsById.get(idValue)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private I${NAME} selectBy(fflib_Criteria criteria)
|
||||
{
|
||||
return new ${NAME}(getRecords(criteria));
|
||||
|
||||
Reference in New Issue
Block a user