Symfony choice type array error: Unable to transform value for property path: Expected an array

Why am I getting an error with this form choice set to multiple. This is coming directly off of Symfonys website. All I changed was the variable name.

 $builder->add('genre', 'choice', array(
    'choices' => array(
        'x'   => 'x',
        'y' => 'y',
        'z'   => 'z',
    ),
    'multiple' => true,
));

This is the error:

Unable to transform value for property path "genre": Expected an array.

Here is my entity class for this variable:

 /**
 * @var string
 *
 * @ORM\Column(name="genre", type="text", nullable=true)
 */
private $genre;


Read more here: https://stackoverflow.com/questions/31686504/symfony-choice-type-array-error-unable-to-transform-value-for-property-path-ex

Content Attribution

This content was originally published by LargeTuna at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: