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<Opportunity> selectByIdWithLineItems(Set<Id> recordIds){
fflib_QueryFactory query = newQueryFactory();
query.setCondition('Id IN :recordIds');
query.addQueryFactorySubselect(
new OpportunityLineItemsSelector().newQueryFactory()
);
return (List<Opportunity>) Database.query( query.toSOQL() );
}
}
I get compile error:
Method does not exist or incorrect signature: void addQueryFactorySubselect(fflib_QueryFactory) from the type fflib_QueryFactory at line 17 column 13
Below method does exist in "fflib_SObjectSelector" class
global fflib_QueryFactory addQueryFactorySubselect(fflib_QueryFactory parentQueryFactory)
{
return addQueryFactorySubselect(parentQueryFactory, true);
}
What am I missing here?
fflib_QueryFactory
vsfflib__QueryFactory
) The signature in yourev_SObjectSelector
class doesn't match the type you're showing in theselectByIdWithLineItems
method.