apex-dml-mocking icon indicating copy to clipboard operation
apex-dml-mocking copied to clipboard

Cannot sort by parent of parent etc.

Open mambafieber opened this issue 1 year ago • 1 comments

Hi, I am using this great framework in my projects and have an issue with the addSortOrder method when sorting by a grandparent field, e.g.:

  public IHistoryRepository getOppLineItemRepo() {
    ...
    oppLineItemRepo.addSortOrder(new List<Schema.SObjectField>{ OpportunityLineItem.OpportunityId, Opportunity.AccountId, Account.Name }, RepositorySortOrder.ASCENDING);
    return oppLineItemRepo;
  }
force-app\factory\RepoFactory.cls  Method does not exist or incorrect signature: void addSortOrder(List<Schema.SObjectField>, RepositorySortOrder) from the type IHistoryRepository

Same thing is happening with the IRepository (and I also guess IAggregateRepo) interfaces. I think there's a line missing in the IRepository interface:

IRepository addParentFields(List<Schema.SObjectField> relationshipFields, List<Schema.SObjectField> parentFields);

Am I correct, or is there something else I am missing?

Kind regards, Jan

mambafieber avatar Sep 27 '24 16:09 mambafieber

@mambafieber I will have a look at this on Monday, thanks for raising this!

jamessimone avatar Sep 27 '24 16:09 jamessimone

@mambafieber this is all set, apologies for the delay and thanks again for bringing this up!

jamessimone avatar Oct 01 '24 14:10 jamessimone

@jamessimone excellent, looking forward to checking out the other changes too. Have a great day!

mambafieber avatar Oct 02 '24 19:10 mambafieber

Thank you, you as well!

jamessimone avatar Oct 03 '24 12:10 jamessimone