我試圖做一個EntityType與我的實體中的數組類型的新表單,但它不起作用。實體類型字段與陣列類型
在我的實體:
/**
* @var array
*
* @ORM\Column(name="category", type="array")
*/
private $category;
而且在我的表格文件:
->add('category', EntityType::class, array(
'class' => 'PlatformBundle:Question',
'choices' => 'category',
'multiple' => true,
'expanded' => true,
))
,我得到這個錯誤:
The option "choices" with value "category" is expected to be of type "null" or "array" or "\Traversable", but is of type "string".
在我的數據庫中有類似的東西:
a:7:{i:0;s:3:"ADC";i:1;s:7:"Support";i:2;s:6:"Middle";i:3;s:6:"Jungle";i:4;s:3:"Top";i:5;s:6:"Leader";i:6;s:8:"Streamer";}
類別是一個DC2Type:陣列
你知道缺少什麼嗎?
感謝您的幫助 漢森
保存在數據中的數據爲基礎其正常其的陣列序列.array( 0 => 'ADC', 1 => '支持', 2 =>' '' 3 =>'叢林', 4 = –