1 | <?php |
||
29 | class FormService implements SingletonInterface |
||
30 | { |
||
31 | /** |
||
32 | * @var bool |
||
33 | */ |
||
34 | protected $formContext; |
||
35 | |||
36 | /** |
||
37 | * @var array|FormInterface |
||
38 | */ |
||
39 | protected $formInstance; |
||
40 | |||
41 | /** |
||
42 | * @var bool |
||
43 | */ |
||
44 | protected $formWasSubmitted; |
||
45 | |||
46 | /** |
||
47 | * @var FormResult |
||
48 | */ |
||
49 | protected $formResult; |
||
50 | |||
51 | /** |
||
52 | * @var FormObject |
||
53 | */ |
||
54 | protected $formObject; |
||
55 | |||
56 | /** |
||
57 | * Reset every state that can be used by this service. |
||
58 | */ |
||
59 | public function resetState() |
||
66 | |||
67 | /** |
||
68 | * Will activate the form context, changing the result returned by the |
||
69 | * function `formContextExists`. |
||
70 | * |
||
71 | * @throws \Exception |
||
72 | */ |
||
73 | public function activateFormContext() |
||
84 | |||
85 | /** |
||
86 | * Returns `true` if the `FormViewHelper` context exists. |
||
87 | * |
||
88 | * @return bool |
||
89 | */ |
||
90 | public function formContextExists() |
||
94 | |||
95 | /** |
||
96 | * Will mark the form as submitted (change the result returned by the |
||
97 | * function `formWasSubmitted()`). |
||
98 | */ |
||
99 | public function markFormAsSubmitted() |
||
103 | |||
104 | /** |
||
105 | * Returns `true` if the form was submitted by the user. |
||
106 | * |
||
107 | * @return bool |
||
108 | */ |
||
109 | public function formWasSubmitted() |
||
113 | |||
114 | /** |
||
115 | * Checks that the current `FormViewHelper` exists. If not, an exception is |
||
116 | * thrown. |
||
117 | * |
||
118 | * @throws \Exception |
||
119 | */ |
||
120 | public function checkIsInsideFormViewHelper() |
||
129 | |||
130 | /** |
||
131 | * If the form was submitted by the user, contains the array containing the |
||
132 | * submitted values. |
||
133 | * |
||
134 | * @param array|FormInterface $formInstance |
||
135 | */ |
||
136 | public function setFormInstance($formInstance) |
||
140 | |||
141 | /** |
||
142 | * @return array|FormInterface |
||
143 | */ |
||
144 | public function getFormInstance() |
||
148 | |||
149 | /** |
||
150 | * @return FormResult |
||
151 | */ |
||
152 | public function getFormResult() |
||
156 | |||
157 | /** |
||
158 | * @param FormResult $formResult |
||
159 | */ |
||
160 | public function setFormResult(FormResult $formResult) |
||
164 | |||
165 | /** |
||
166 | * @return FormObject |
||
167 | */ |
||
168 | public function getFormObject() |
||
172 | |||
173 | /** |
||
174 | * @param FormObject $formObject |
||
175 | */ |
||
176 | public function setFormObject(FormObject $formObject) |
||
180 | } |
||
181 |