Total Complexity | 3 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
11 | class FormFactory |
||
12 | { |
||
13 | /** |
||
14 | * @var FormFactoryInterface |
||
15 | */ |
||
16 | private $formFactory; |
||
17 | |||
18 | /** |
||
19 | * @var RouterInterface |
||
20 | */ |
||
21 | private $router; |
||
22 | |||
23 | /** |
||
24 | * @param FormFactoryInterface $formFactory |
||
25 | * @param RouterInterface $router |
||
26 | */ |
||
27 | public function __construct( |
||
28 | FormFactoryInterface $formFactory, |
||
29 | RouterInterface $router |
||
30 | ) { |
||
31 | $this->formFactory = $formFactory; |
||
32 | $this->router = $router; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @param Form $component |
||
37 | * @return \Symfony\Component\Form\FormInterface |
||
38 | */ |
||
39 | public function createForm(Form $component): FormInterface |
||
40 | { |
||
41 | return $this->formFactory->create( |
||
42 | $component->getFormType(), |
||
43 | null, |
||
44 | [ |
||
45 | 'method' => 'POST', |
||
46 | 'action' => $this->router->generate('silverback_api_component_form_submit', [ |
||
47 | 'id' => $component->getId() |
||
48 | ]) |
||
49 | ] |
||
50 | ); |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @param Form $component |
||
55 | * @return FormView |
||
56 | */ |
||
57 | public function createFormView(Form $component) |
||
61 | } |
||
62 | } |
||
63 |