fix deprecations: add choices_as_values=true + flip contents of choice in ChoiceType

This commit is contained in:
nobohan 2018-04-04 22:01:52 +02:00
parent 3e9690f47e
commit a35fd76053
3 changed files with 4 additions and 1 deletions

View File

@ -85,7 +85,8 @@ class CustomFieldChoice extends AbstractCustomField
//prepare $options
$options = array(
'multiple' => $customFieldOptions[self::MULTIPLE],
'choices' => $choices,
'choices' => array_combine(array_values($choices),array_keys($choices)),
'choices_as_values' => true,
'required' => $customField->isRequired(),
'label' => $this->translatableStringHelper->localize($customField->getName()));

View File

@ -34,6 +34,7 @@ class ChoiceWithOtherType extends AbstractType
$options['expanded'] = true;
// adding a default value for choice
$options['empty_data'] = null;
$options['choices_as_values'] = true;
$builder
->add('_other', TextType::class, array('required' => false))

View File

@ -110,6 +110,7 @@ class LinkedCustomFieldsType extends AbstractType
$options = array_merge($this->options, array(
'choice_list' => new SimpleChoiceList($choices),
'choices_as_values' => true
));
$event->getForm()->getParent()->add($this->choiceName, ChoiceType::class,