Skip to main content
1 of 4
Mitesh Sura
  • 699
  • 1
  • 10
  • 21

Salesforce Selector layer - subquery

We have been using FF library for Separation of Concerns framework and it is working great. We need to add subquery to it, but running into issues. Example I am following is from this article: https://quirkyapex.com/2016/08/18/fflib-selector-layer/

public class OpportunityLineItemsSelector extends fflib_SObjectSelector {

public Schema.SObjectType getSObjectType(){ return OpportunityLineItem.sObjectType; }

public override List<Schema.SObjectField> getSObjectFieldList(){ return new List<Schema.SObjectField> { OpportunityLineItem.Id, OpportunityLineItem.Quantity, OpportunityLineItem.SalesPrice }; }

}

public class OpportunitiesSelector extends fflib_SObjectSelector {

public Schema.SObjectType getSObjectType(){ return Opportunity.sObjectType; }

public override List<Schema.SObjectField> getSObjectFieldList(){ return new List<Schema.SObjectField> { Opportunity.Id, Opportunity.StageName }; }

public List selectByIdWithLineItems(Set recordIds){ fflib_QueryFactory query = newQueryFactory(); query.setCondition('Id IN :recordIds'); query.addQueryFactorySubselect( new OpportunityLineItemsSelector().newQueryFactory() ); return (List) Database.query( query.toSOQL() ); }

}

I get compile error: Method does not exist or incorrect signature: void addQueryFactorySubselect(ev_QueryFactory) from the type ev_QueryFactory at line 17 column 13

Below method does exist in "ev_SObjectSelector" class

global fflib__QueryFactory addQueryFactorySubselect(fflib__QueryFactory parentQueryFactory)
{
    return addQueryFactorySubselect(parentQueryFactory, true);
}

What am I missing here?

Mitesh Sura
  • 699
  • 1
  • 10
  • 21