dongyu6276 2015-12-02 10:47 采纳率: 0%
浏览 90

Symfony2复杂形式的最佳实践

I have a complex database schema in my Symfony2 application, with a lot of entities linked to each others.

Consequently, my forms are also complicated : I can have many linked forms ; for example a "Cinema" can have an Address, but can also be linked to several "Movies" (with a button to add a new movie).

It's very very difficult to handle this using basic Symfony2 form Types ; I prefer to create my own form manually in a Twig view ; using a bunch of Javascript.

But I don't know how to handle the form submission ?

  • Should I define a CinemaType and use it only to handle the form request (but not for creating the form view) ?
  • Should I use a createFormBuilder() in my Controller to define the basic form fields and check them with the handleRequest() method ?
  • Or, finally, should get all my _POST data and check them manually ?

Thanks :)

  • 写回答

2条回答 默认 最新

  • duan36000 2015-12-02 11:33
    关注

    You can always create your own simple form class that implements the same methods as the Symfony2 ones:

    • handleRequest
    • validate
    • createView

    And so on.

    评论

报告相同问题?

悬赏问题

  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题