用户sumbits这是构建使用symfony的2框架与抽象类型的一种形式:获取AbstractType从请求
<?php
$form = $this->createForm(new MyAbstractType(), new MyEntity());
我接收在动作此篇请求:
public function receiveFormRequestAction(Request $request){
//How do I get the abstract type from the request?
}
我需要能够仅使用请求中的信息创建表单上使用的AbstractType。
- 这可能吗?
- 你怎么做到的?
谢谢。
编辑:
对不起,如果我不够清楚。在“recieveFormRequestAction”方法中,我不知道我将得到什么抽象类型,所以我不能直接将表单绑定到MyAbstractType。
理论上,此操作可以接收任何AbastractType并将其绑定。