-1

In the form builder I have added field with:

type : ChoiceType
multiple : true

In the entityfile that column is defined as:

Type : string

The same column in database table contains type text.

Now I want to insert values selected in form field as comma separated string.

But in below steps it is not allowing to submit the form and throwing error.

$form->handleRequest($request);

Here, the system is not setting any data of the field from $request to $form

$form->isValid()

So, this is not allowing to submit form and, also throws an error.

So, what I need to my data works in the correct way?

William Prigol Lopes
  • 1,803
  • 14
  • 31

1 Answers1

0

You need to use a DataTransformer. This will allow you to transform the array from the form into a string. Check here

Alexander Dimitrov
  • 944
  • 1
  • 6
  • 17