public function configureOptions(OptionsResolver
$resolver) { $choiceLoader =
function DOptions
$options) { // Unless the choices are given explicitly, load them on demand
if (null ===
$options['choices'
]) { // If there is no QueryBuilder we can safely cache
$vary =
[$options['em'
],
$options['class'
]];
// also if concrete Type can return important QueryBuilder parts to generate
// hash key we go for it as well, otherwise fallback on the instance
if ($options['query_builder'
]) { $vary[] =
$this->
getQueryBuilderPartsForCachingHash($options['query_builder'
]) ??
$options['query_builder'
];
} return ChoiceList::
loader($this,
new DoctrineChoiceLoader( $options['em'
],
$options['class'
],
$options['id_reader'
],
$this->
getCachedEntityLoader( $options['em'
],
$options['query_builder'
] ??
$options['em'
]->
getRepository($options['class'
])->
createQueryBuilder('e'
),
$options['class'
],
$vary )