/**
  * {@inheritdoc}
  */
 protected function buildAutocompleteContext(array $options)
 {
     $context = parent::buildAutocompleteContext($options);
     if (isset($options['select2_options']['tags']) && $options['select2_options']['tags']) {
         $context->setProvider('select2_tags');
     } else {
         $context->setProvider('select2');
     }
     $context->setParameter('select2_template_result', $options['select2_template_result']);
     $context->setParameter('select2_template_selection', $options['select2_template_selection']);
     return $context;
 }
 /**
  * {@inheritdoc}
  *
  * @throws AccessException
  * @throws UndefinedOptionsException
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefault('autocomplete_min_length', 1);
 }