1 | <?php |
||
27 | class FormObjectConfiguration |
||
28 | { |
||
29 | /** |
||
30 | * @var FormObjectStatic |
||
31 | */ |
||
32 | protected $static; |
||
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $configurationArray = []; |
||
38 | |||
39 | /** |
||
40 | * Contains the form configuration object, which was created from the |
||
41 | * configuration array. |
||
42 | * |
||
43 | * @var ConfigurationObjectInstance |
||
44 | */ |
||
45 | protected $configurationObject; |
||
46 | |||
47 | /** |
||
48 | * @var Result |
||
49 | */ |
||
50 | protected $configurationValidationResult; |
||
51 | |||
52 | /** |
||
53 | * Flag to know if the form configuration is valid or not: if the |
||
54 | * configuration is fetched from cache, then we know the configuration is |
||
55 | * valid because it saved in cache only when no error is found. |
||
56 | * |
||
57 | * @var bool |
||
58 | */ |
||
59 | protected $configurationIsValid = false; |
||
60 | |||
61 | /** |
||
62 | * @param FormObjectStatic $static |
||
63 | * @param array $configurationArray |
||
64 | */ |
||
65 | public function __construct(FormObjectStatic $static, array $configurationArray) |
||
70 | |||
71 | /** |
||
72 | * Returns an instance of configuration object. Checks if it was previously |
||
73 | * stored in cache, otherwise it is created from scratch. |
||
74 | * |
||
75 | * @return ConfigurationObjectInstance |
||
76 | */ |
||
77 | public function getConfigurationObject() |
||
85 | |||
86 | /** |
||
87 | * This function will merge and return the validation results of both the |
||
88 | * global FormZ configuration object, and this form configuration object. |
||
89 | * |
||
90 | * @return Result |
||
91 | */ |
||
92 | public function getConfigurationValidationResult() |
||
100 | |||
101 | /** |
||
102 | * Resets the validation result and merges it with the global FormZ |
||
103 | * configuration. |
||
104 | * |
||
105 | * @return Result |
||
106 | */ |
||
107 | protected function getGlobalConfigurationValidationResult() |
||
125 | |||
126 | /** |
||
127 | * @param ConfigurationObjectInstance $configurationObject |
||
128 | * @return Result |
||
129 | */ |
||
130 | protected function getFormConfigurationValidationResult(ConfigurationObjectInstance $configurationObject) |
||
143 | |||
144 | /** |
||
145 | * @return ConfigurationObjectInstance |
||
146 | */ |
||
147 | protected function getConfigurationObjectFromCache() |
||
168 | |||
169 | /** |
||
170 | * This function will clean the configuration array by removing useless data |
||
171 | * and updating needed ones. |
||
172 | * |
||
173 | * @param array $configuration |
||
174 | * @return array |
||
175 | */ |
||
176 | protected function sanitizeConfiguration(array $configuration) |
||
194 | |||
195 | /** |
||
196 | * Middlewares of the form are stored in cache, so their dependencies must |
||
197 | * be injected again when they are fetched from cache. |
||
198 | * |
||
199 | * @param ConfigurationObjectInstance $configurationObject |
||
200 | */ |
||
201 | protected function injectDependenciesInConfiguration(ConfigurationObjectInstance $configurationObject) |
||
210 | |||
211 | /** |
||
212 | * @param array $configuration |
||
213 | * @return ConfigurationObjectInstance |
||
214 | */ |
||
215 | protected function getConfigurationObjectInstance(array $configuration) |
||
219 | |||
220 | /** |
||
221 | * @return FrontendInterface |
||
222 | */ |
||
223 | protected function getCacheInstance() |
||
227 | |||
228 | /** |
||
229 | * @return array |
||
230 | */ |
||
231 | public function __sleep() |
||
235 | } |
||
236 |