monsieurbiz / SyliusSettingsPlugin

Provide some custom settings to your favorite Sylius shop!
MIT License
23 stars 18 forks source link

Use multiple option in ChoiceType with default value #38

Closed TonySma closed 3 years ago

TonySma commented 3 years ago

There is a bug in the Configuration definition when using a Choice Type with multiple option = true, we cannot use array

$this->addWithDefaultCheckbox(
    $builder, 'my_field', ChoiceType::class, [
    'required' => true,
    'multiple' => true,
    'choices'  => [
       'option1' => 'option1'
       'option2' => 'option2'
    ],
]);
app.common:
          ...
          default_values:
              my_field:
                - option1

Then the error occurs:

In ScalarNode.php line 36:

  Invalid type for path "monsieurbiz_sylius_settings.plugins.app.common.default_values.my_field". Expected "scalar", but got "array".                                                                                                                                                

A PR will follow