如何解决Sonata Admin 嵌套集合表单创建不起作用但删除和编辑可以
我在与奏鸣曲管理形式映射器嵌套CollectionType一些问题。 母体形式看起来像这样:
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
// ....
->with('group.CustomerServices',['description' => 'description.contract.CustomerServices'])
->add(
'services',CollectionType::class,[
'entry_type' => ServiceType::class,'required' => false,'allow_add' => true,'allow_delete' => true,'by_reference' => false,]
)
->end()
// ....
然后是孩子的ServiceType
public function buildForm(FormBuilderInterface $builder,array $options)
{
$builder
->add('obligation',ChoiceType::class,[
'required' => true,'choices' => ServiceObligationEnum::getChoices(),])
->add('interval',[
'required' => false,'choices' => ServiceIntervalEnum::getChoices(),],])
->add('value',SebastianMoneyType::class,])
->add('currency','choices' => CurrencyEnum::getChoices(),]);
Submiting编辑按钮 - >编辑现有的服务也删除它们正在.. 但是,增加一个新的,submiting发送一个正确的POST请求(使用选定的值),但在前端访问该服务时,一切都在默认值。有人可以解释我在哪里可以检查POST请求的处理方式,并帮助我了解工作流程为何增加/ create不工作,同时删除和编辑做。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。