Let's make it possible to configure a custom query set to use when prefetching records.
Context
In some situations, it may be necessary to ensure that records are prefetched using a specific query set. This would be the case when:
A custom filtering must be applied and a prefetching operation is required.
A custom ordering must be applied and a prefetching operation is required.
Proposition
To allow for that, let's introduce an alternative version of the #prefetch method that takes a single relation name as input and an optional query set object:
The configured prefetch operation should take into account the specified query set if one is specified; otherwise, the default one should be used. Special care should be taken to ensure that the type of the query set type is consistent with the specified relation.
Description
Let's make it possible to configure a custom query set to use when prefetching records.
Context
In some situations, it may be necessary to ensure that records are prefetched using a specific query set. This would be the case when:
Proposition
To allow for that, let's introduce an alternative version of the
#prefetch
method that takes a single relation name as input and an optional query set object:The configured prefetch operation should take into account the specified query set if one is specified; otherwise, the default one should be used. Special care should be taken to ensure that the type of the query set type is consistent with the specified relation.