1 | <?php |
||
18 | class FormFactory |
||
19 | { |
||
20 | /** |
||
21 | * @var SymfonyFormFactory |
||
22 | */ |
||
23 | protected $formFactory; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $configuration; |
||
29 | |||
30 | /** |
||
31 | * @var DataProvider[] |
||
32 | */ |
||
33 | protected $dataProviders = []; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $eventSubscribers = []; |
||
39 | |||
40 | /** |
||
41 | * @var HelpMessageProvider[] |
||
42 | */ |
||
43 | protected $helpMessageProviders = []; |
||
44 | |||
45 | /** |
||
46 | * @param SymfonyFormFactory $formFactory |
||
47 | */ |
||
48 | public function setFormFactory(SymfonyFormFactory $formFactory): void |
||
52 | |||
53 | /** |
||
54 | * @param array $configuration |
||
55 | */ |
||
56 | public function setConfiguration(array $configuration): void |
||
60 | |||
61 | /** |
||
62 | * @param string $alias |
||
63 | * @param DataProvider $dataProvider |
||
64 | */ |
||
65 | public function addDataProvider($alias, DataProvider $dataProvider): void |
||
69 | |||
70 | /** |
||
71 | * @param string $alias |
||
72 | * @param HelpMessageProvider $helpMessageProvider |
||
73 | */ |
||
74 | public function addHelpMessageProvider($alias, HelpMessageProvider $helpMessageProvider): void |
||
78 | |||
79 | /** |
||
80 | * @param string $formName |
||
81 | * @param EventSubscriberInterface $eventSubscriber |
||
82 | */ |
||
83 | public function addEventSubscriber($formName, EventSubscriberInterface $eventSubscriber): void |
||
91 | |||
92 | /** |
||
93 | * @param string $key The key of the Form in the form configuration |
||
94 | * @param array $data |
||
95 | * @param array $options |
||
96 | * @param string $name An name for the form. If empty, the key will be used |
||
97 | * |
||
98 | * @return FormInterface |
||
99 | */ |
||
100 | public function createForm($key, $data = [], $options = [], $name = null) |
||
104 | |||
105 | /** |
||
106 | * This method generates a form based on the configuration file. |
||
107 | * |
||
108 | * @param string $key The key of the Form in the form configuration |
||
109 | * @param array $data |
||
110 | * @param array $options |
||
111 | * @param string $name An name for the form. If empty, the key will be used |
||
112 | * |
||
113 | * @throws NonExistentFormException |
||
114 | * |
||
115 | * @return FormBuilderInterface |
||
116 | */ |
||
117 | public function createBuilder($key, $data = [], $options = [], $name = null) |
||
176 | |||
177 | /** |
||
178 | * This method generates a validator based on the configuration file. |
||
179 | * |
||
180 | * @param string $key The key of the Form in the form configuration |
||
181 | * @param mixed $object Object which is the target of the validator |
||
182 | * |
||
183 | * @throws NonExistentFormException |
||
184 | * |
||
185 | * @return ValidatorInterface |
||
186 | */ |
||
187 | public function createValidator($key, $object) |
||
212 | |||
213 | /** |
||
214 | * @param string $alias |
||
215 | * |
||
216 | * @throws NotExistentDataProviderException |
||
217 | * |
||
218 | * @return DataProvider |
||
219 | */ |
||
220 | public function loadDataProvider($alias) |
||
228 | |||
229 | /** |
||
230 | * @param string $alias |
||
231 | * |
||
232 | * @throws NotExistentDataProviderException |
||
233 | * |
||
234 | * @return HelpMessageProvider |
||
235 | */ |
||
236 | public function loadHelpMessageProvider($alias) |
||
244 | |||
245 | /** |
||
246 | * @param string $name |
||
247 | * |
||
248 | * @throws NonExistentFormException |
||
249 | * |
||
250 | * @return array |
||
251 | */ |
||
252 | public function getConfiguration($name = null) |
||
264 | |||
265 | /** |
||
266 | * Checks if a given form exists. |
||
267 | * |
||
268 | * @param string $name |
||
269 | * |
||
270 | * @return bool |
||
271 | */ |
||
272 | public function has($name) |
||
276 | } |
||
277 |