1 | <?php |
||
23 | class FormObjectStatic |
||
24 | { |
||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $className; |
||
29 | |||
30 | /** |
||
31 | * @var FormDefinitionObject |
||
32 | */ |
||
33 | protected $definition; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $objectHash; |
||
39 | |||
40 | /** |
||
41 | * @var FormObjectConfiguration |
||
42 | */ |
||
43 | protected $configurationService; |
||
44 | |||
45 | /** |
||
46 | * @param string $className |
||
47 | * @param FormDefinitionObject $definition |
||
48 | */ |
||
49 | public function __construct($className, FormDefinitionObject $definition) |
||
50 | { |
||
51 | $this->className = $className; |
||
52 | $this->definition = $definition; |
||
53 | $this->configurationService = Core::instantiate(FormObjectConfiguration::class, $this, $definition); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @return string |
||
58 | */ |
||
59 | public function getClassName() |
||
63 | |||
64 | /** |
||
65 | * @return FormDefinition |
||
66 | */ |
||
67 | public function getDefinition() |
||
68 | { |
||
69 | /** @var FormDefinition $configuration */ |
||
70 | $configuration = $this->definition->getObject(true); |
||
71 | |||
72 | return $configuration; |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * This function will merge and return the validation results of both the |
||
77 | * global FormZ configuration object, and this form configuration object. |
||
78 | * |
||
79 | * @return Result |
||
80 | */ |
||
81 | public function getDefinitionValidationResult() |
||
82 | { |
||
83 | return $this->configurationService->getConfigurationValidationResult(); |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * Returns the hash of the form object, which should be calculated only once |
||
88 | * for performance concerns. |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | public function getObjectHash() |
||
100 | |||
101 | /** |
||
102 | * Returns the calculated hash of the form object. |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | protected function calculateObjectHash() |
||
116 | } |
||
117 |