1 | <?php |
||
43 | class AjaxValidationController extends ActionController |
||
44 | { |
||
45 | const DEFAULT_ERROR_MESSAGE_KEY = 'default_error_message'; |
||
46 | |||
47 | |||
48 | /** |
||
49 | * @var Request |
||
50 | */ |
||
51 | protected $request; |
||
52 | |||
53 | /** |
||
54 | * @var Response |
||
55 | */ |
||
56 | protected $response; |
||
57 | |||
58 | /** |
||
59 | * @var bool |
||
60 | */ |
||
61 | protected $protectedRequestMode = true; |
||
62 | |||
63 | /** |
||
64 | * @var string |
||
65 | */ |
||
66 | protected $formClassName; |
||
67 | |||
68 | /** |
||
69 | * @var string |
||
70 | */ |
||
71 | protected $formName; |
||
72 | |||
73 | /** |
||
74 | * @var string |
||
75 | */ |
||
76 | protected $fieldName; |
||
77 | |||
78 | /** |
||
79 | * @var string |
||
80 | */ |
||
81 | protected $validatorName; |
||
82 | |||
83 | /** |
||
84 | * @var FormInterface |
||
85 | */ |
||
86 | protected $form; |
||
87 | |||
88 | /** |
||
89 | * @var FormObject |
||
90 | */ |
||
91 | protected $formObject; |
||
92 | |||
93 | /** |
||
94 | * @var AjaxResult |
||
95 | */ |
||
96 | protected $result; |
||
97 | |||
98 | /** |
||
99 | * @var Validation |
||
100 | */ |
||
101 | protected $validation; |
||
102 | |||
103 | /** |
||
104 | * The only accepted method for the request is `POST`. |
||
105 | */ |
||
106 | public function initializeAction() |
||
112 | |||
113 | /** |
||
114 | * Will process the request, but also prevent any external message to be |
||
115 | * displayed, and catch any exception that could occur during the |
||
116 | * validation. |
||
117 | * |
||
118 | * @param RequestInterface $request |
||
119 | * @param ResponseInterface $response |
||
120 | * @throws Exception |
||
121 | */ |
||
122 | public function processRequest(RequestInterface $request, ResponseInterface $response) |
||
149 | |||
150 | /** |
||
151 | * Will take care of adding a new argument to the request, based on the form |
||
152 | * name and the form class name found in the request arguments. |
||
153 | */ |
||
154 | protected function initializeActionMethodValidators() |
||
180 | |||
181 | /** |
||
182 | * Main action that will process the field validation. |
||
183 | * |
||
184 | * @param string $name |
||
185 | * @param string $className |
||
186 | * @param string $fieldName |
||
187 | * @param string $validatorName |
||
188 | */ |
||
189 | public function runAction($name, $className, $fieldName, $validatorName) |
||
216 | |||
217 | /** |
||
218 | * @return Validation |
||
219 | * @throws EntryNotFoundException |
||
220 | * @throws InvalidConfigurationException |
||
221 | */ |
||
222 | protected function getFieldValidation() |
||
250 | |||
251 | /** |
||
252 | * Fetches errors/warnings/notices in the result, and put them in the JSON |
||
253 | * response. |
||
254 | */ |
||
255 | protected function injectResultInResponse() |
||
275 | |||
276 | /** |
||
277 | * @param array $result |
||
278 | */ |
||
279 | protected function setUpResponseResult(array $result) |
||
286 | |||
287 | /** |
||
288 | * @param FormzMessageInterface[] $messages |
||
289 | * @return array |
||
290 | */ |
||
291 | protected function formatMessages(array $messages) |
||
301 | |||
302 | /** |
||
303 | * Wrapper for unit tests. |
||
304 | * |
||
305 | * @param RequestInterface $request |
||
306 | * @param ResponseInterface $response |
||
307 | */ |
||
308 | protected function processRequestParent(RequestInterface $request, ResponseInterface $response) |
||
312 | |||
313 | /** |
||
314 | * Wrapper for unit tests. |
||
315 | */ |
||
316 | protected function initializeActionMethodValidatorsParent() |
||
320 | |||
321 | /** |
||
322 | * Used in unit testing. |
||
323 | * |
||
324 | * @param bool $flag |
||
325 | */ |
||
326 | public function setProtectedRequestMode($flag) |
||
330 | |||
331 | /** |
||
332 | * @param Exception $exception |
||
333 | * @return string |
||
334 | */ |
||
335 | protected function getDebugMessageForException(Exception $exception) |
||
339 | |||
340 | /** |
||
341 | * @return FormInterface |
||
342 | * @throws MissingArgumentException |
||
343 | */ |
||
344 | protected function getForm() |
||
348 | |||
349 | /** |
||
350 | * @return FormObject |
||
351 | */ |
||
352 | protected function getFormObject() |
||
359 | |||
360 | /** |
||
361 | * Wrapper for unit tests. |
||
362 | * |
||
363 | * @return Request |
||
364 | */ |
||
365 | protected function getRequest() |
||
369 | } |
||
370 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.