Refactor of getChildIdsById and getGrandParentIdById of fflib_SObject2

The methods are no longer depended on the domain method getRelatedFieldByDomainType, which could only relate a relationship with a single field. This change will allow to build the map with the correct fields when there are multiple relationships to the related SObjectType.

 for example if an SObject has two relations to Account; BillingAccountId and AccountId, then we can now specify in the method parameters which relationship should be taken.

Signed-off-by: WimVelzeboer <william@velzeboer.nl>
This commit is contained in:
WimVelzeboer
2023-04-27 11:27:45 +01:00
parent a4753d1db1
commit 1b03239c6d
3 changed files with 165 additions and 25 deletions
@@ -29,6 +29,10 @@
*/
public interface fflib_ISObjects2 extends fflib_ISObjects
{
Map<Id, Set<Id>> getChildIdsById(Map<Schema.SObjectField, fflib_SObjects2> domainsByRelationshipField);
Map<Id, Id> getParentIdById(Map<Schema.SObjectField, fflib_SObjects2> domainsByRelationshipField);
// DEPRECATED METHODS
Map<Id, Id> getGrandParentIdById(List<fflib_ISObjects2> relatedDomains);
Map<Id, Set<Id>> getChildIdsById(List<fflib_SObjects2> relatedDomains);
}