我有这个表单返回ArrayCollection
$builder
->add('secondSubcategory', 'entity', array(
'required' => false,
'class' => 'AppBundle\Entity\SecondSubcategory',
'choice_label' => 'name',
'label' => false,
'multiple' => true,
'expanded' => true,
))
;
我正在使用SyliusFormBundle,我想将此结果设置为会话存储,就像这样
对于displayAction:
$selected_categories = $context->getStorage()->get('second.subcategory');
$em = $this->getDoctrine()->getManager();
$selected_categories = $em->merge($selected_categories);
对于forwardAction:
...
$em->detach($selected_categories);
但我是ArrayCollection,我应该使用实体对象吗?连载?或只存储ID?