1 | <?php |
||
15 | class FormFactory |
||
16 | { |
||
17 | /** |
||
18 | * @var SymfonyFormFactory |
||
19 | */ |
||
20 | protected $formFactory; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $configuration; |
||
26 | |||
27 | /** |
||
28 | * @var DataProvider[] |
||
29 | */ |
||
30 | protected $dataProviders = []; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $eventSubscribers = []; |
||
36 | |||
37 | /** |
||
38 | * @var HelpMessageProvider[] |
||
39 | */ |
||
40 | protected $helpMessageProviders = []; |
||
41 | |||
42 | /** |
||
43 | * @param SymfonyFormFactory $formFactory |
||
44 | */ |
||
45 | public function setFormFactory(SymfonyFormFactory $formFactory) |
||
49 | |||
50 | /** |
||
51 | * @param array $configuration |
||
52 | */ |
||
53 | public function setConfiguration(array $configuration) |
||
57 | |||
58 | /** |
||
59 | * @param string $alias |
||
60 | * @param DataProvider $dataProvider |
||
61 | */ |
||
62 | public function addDataProvider($alias, DataProvider $dataProvider) |
||
66 | |||
67 | /** |
||
68 | * @param string $alias |
||
69 | * @param HelpMessageProvider $helpMessageProvider |
||
70 | */ |
||
71 | public function addHelpMessageProvider($alias, HelpMessageProvider $helpMessageProvider) |
||
75 | |||
76 | /** |
||
77 | * @param string $formName |
||
78 | * @param EventSubscriberInterface $eventSubscriber |
||
79 | */ |
||
80 | public function addEventSubscriber($formName, EventSubscriberInterface $eventSubscriber) |
||
88 | |||
89 | /** |
||
90 | * @param string $key The key of the Form in the form configuration |
||
91 | * @param array $data |
||
92 | * @param array $options |
||
93 | * @param string $name An name for the form. If empty, the key will be used |
||
94 | * |
||
95 | * @return FormInterface |
||
96 | */ |
||
97 | public function createForm($key, $data = [], $options = [], $name = null) |
||
101 | |||
102 | /** |
||
103 | * This method generates a form based on the configuration file. |
||
104 | * |
||
105 | * @param string $key The key of the Form in the form configuration |
||
106 | * @param array $data |
||
107 | * @param array $options |
||
108 | * @param string $name An name for the form. If empty, the key will be used |
||
109 | * |
||
110 | * @return FormBuilderInterface |
||
111 | * |
||
112 | * @throws NonExistentFormException |
||
113 | */ |
||
114 | public function createBuilder($key, $data = [], $options = [], $name = null) |
||
173 | |||
174 | /** |
||
175 | * This method generates a validator based on the configuration file. |
||
176 | * |
||
177 | * @param string $key The key of the Form in the form configuration |
||
178 | * @param mixed $object Object which is the target of the validator |
||
179 | * |
||
180 | * @return ValidatorInterface |
||
181 | * |
||
182 | * @throws NonExistentFormException |
||
183 | */ |
||
184 | public function createValidator($key, $object) |
||
209 | |||
210 | /** |
||
211 | * @param string $alias |
||
212 | * |
||
213 | * @return DataProvider |
||
214 | * |
||
215 | * @throws NotExistentDataProviderException |
||
216 | */ |
||
217 | public function loadDataProvider($alias) |
||
225 | |||
226 | /** |
||
227 | * @param string $alias |
||
228 | * |
||
229 | * @return HelpMessageProvider |
||
230 | * |
||
231 | * @throws NotExistentDataProviderException |
||
232 | */ |
||
233 | public function loadHelpMessageProvider($alias) |
||
241 | |||
242 | /** |
||
243 | * @param string $name |
||
244 | * |
||
245 | * @return array |
||
246 | * |
||
247 | * @throws NonExistentFormException |
||
248 | */ |
||
249 | public function getConfiguration($name = null) |
||
261 | |||
262 | /** |
||
263 | * Checks if a given form exists. |
||
264 | * |
||
265 | * @param string $name |
||
266 | * |
||
267 | * @return bool |
||
268 | */ |
||
269 | public function has($name) |
||
273 | } |
||
274 |