This repository has been archived by the owner on Mar 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
EntryNotFoundException.php
561 lines (481 loc) 路 15.6 KB
/
EntryNotFoundException.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
<?php
/*
* 2017 Romain CANON <romain.hydrocanon@gmail.com>
*
* This file is part of the TYPO3 FormZ project.
* It is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License, either
* version 3 of the License, or any later version.
*
* For the full copyright and license information, see:
* http://www.gnu.org/licenses/gpl-3.0.html
*/
namespace Romm\Formz\Exceptions;
use Romm\Formz\Configuration\Configuration;
use Romm\Formz\Configuration\View\Classes\ViewClass;
use Romm\Formz\Configuration\View\Layouts\LayoutGroup;
use Romm\Formz\Configuration\View\View;
use Romm\Formz\Form\Definition\Field\Field;
use Romm\Formz\Form\Definition\Field\Validation\Validator;
use Romm\Formz\Form\Definition\FormDefinition;
use Romm\Formz\Form\FormInterface;
use Romm\Formz\Form\FormObject\FormObject;
use Romm\Formz\Form\FormObject\FormObjectFactory;
use Romm\Formz\Validation\Field\AbstractFieldValidator;
use Romm\Formz\ViewHelpers\ClassViewHelper;
use Romm\Formz\ViewHelpers\FieldViewHelper;
use Romm\Formz\ViewHelpers\FormatMessageViewHelper;
class EntryNotFoundException extends FormzException
{
const FIELD_NOT_FOUND = 'The field "%s" was not found in the form "%s" with class "%s".';
const CONDITION_NOT_FOUND = 'Trying to access a condition which is not registered: "%s". Here is a list of all currently registered conditions: "%s".';
const FORM_ADD_CONDITION_NOT_FOUND = 'Trying to add a condition "%s" which is not registered to the form definition. Here is a list of all currently registered conditions: "%s".';
const ACTIVATION_ADD_CONDITION_NOT_FOUND = 'Trying to add a condition "%s" which is not registered to the activation. Here is a list of all currently registered conditions: "%s".';
const INSTANTIATE_CONDITION_NOT_FOUND = 'Trying to instantiate a condition which is not registered: "%s". Here is a list of all currently registered conditions: "%s".';
const ACTIVATION_CONDITION_NOT_FOUND = 'No condition "%s" was found.';
const CONFIGURATION_FIELD_NOT_FOUND = 'The field "%s" was not found. Please use the function `%s::hasField()` before.';
const VALIDATOR_NOT_FOUND = 'The validation "%s" was not found. Please use the function `%s::hasValidator()` before.';
const BEHAVIOUR_NOT_FOUND = 'The behaviour "%s" was not found. Please use the function `%s::hasBehaviour()` before.';
const MESSAGE_NOT_FOUND = 'The message "%s" was not found. Please use the function `%s::hasMessage()` before.';
const VIEW_LAYOUT_NOT_FOUND = 'The layout "%s" was not found. Please use the function `%s::hasLayout()` before.';
const VIEW_LAYOUT_ITEM_NOT_FOUND = 'The layout item "%s" was not found. Please use the function `%s::hasItem()` before.';
const VIEW_CLASS_NOT_FOUND = 'The class "%s" was not found. Please use the function `%s::hasItem()` before.';
const VALIDATION_NOT_FOUND_FOR_FIELD = 'The field "%s" does not have a rule "%s".';
const ERROR_KEY_NOT_FOUND_FOR_VALIDATOR = 'The error key "%s" does not exist for the validator "%s".';
const VIEW_HELPER_FIELD_NOT_FOUND = 'The field could not be fetched for the view helper "%s": please either use this view helper inside the view helper "%s", or fill the parameter `field` of this view helper with the field name you want.';
const FIELD_VIEW_HELPER_LAYOUT_NOT_FOUND = 'The layout "%s" could not be found. Please check your TypoScript configuration.';
const FIELD_VIEW_HELPER_LAYOUT_ITEM_NOT_FOUND = 'The layout "%s" does not have an item "%s".';
const CONTROLLER_SERVICE_ACTION_FORM_ARGUMENT_MISSING = 'The method `%s::%s()` must have a parameter `$%s`. Note that you can also change the parameter `name` of the form view helper.';
const SLOT_NOT_FOUND = 'No slot "%s" was found.';
const FORM_CONFIGURATION_NOT_FOUND = 'The configuration for form of class "%s" was not found. Please use the function `%s::hasForm()` before.';
const CONDITION_NOT_FOUND_IN_DEFINITION = 'The condition "%s" was not found in the form definition. Please use the function `%s::hasCondition()` before.';
const CONDITION_DOES_NOT_EXIST = 'The condition "%s" does not exist';
const FORM_OBJECT_INSTANCE_NOT_FOUND = 'The form instance for the object of type "%s" was not found. Please take care of registering it before with "%s::registerFormInstance()".';
/**
* @code 1472650209
*
* @param string $identifier
* @param array $list
* @return self
*/
final public static function conditionNotFound($identifier, array $list)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::CONDITION_NOT_FOUND,
[
$identifier,
implode('" ,"', array_keys($list))
]
);
return $exception;
}
/**
* @code 1493890438
*
* @param string $identifier
* @param array $list
* @return self
*/
final public static function formAddConditionNotFound($identifier, array $list)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::FORM_ADD_CONDITION_NOT_FOUND,
[
$identifier,
implode('" ,"', array_keys($list))
]
);
return $exception;
}
/**
* @code 1494329341
*
* @param string $identifier
* @param array $list
* @return self
*/
final public static function activationAddConditionNotFound($identifier, array $list)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::ACTIVATION_ADD_CONDITION_NOT_FOUND,
[
$identifier,
implode('" ,"', array_keys($list))
]
);
return $exception;
}
/**
* @code 1493890825
*
* @param string $identifier
* @param array $list
* @return self
*/
final public static function instantiateConditionNotFound($identifier, array $list)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::INSTANTIATE_CONDITION_NOT_FOUND,
[
$identifier,
implode('" ,"', array_keys($list))
]
);
return $exception;
}
/**
* @code 1488482191
*
* @param string $name
* @return self
*/
final public static function activationConditionNotFound($name)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::ACTIVATION_CONDITION_NOT_FOUND,
[$name]
);
return $exception;
}
/**
* @code 1489765133
*
* @param string $name
* @return self
*/
final public static function configurationFieldNotFound($name)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::CONFIGURATION_FIELD_NOT_FOUND,
[$name, FormDefinition::class]
);
return $exception;
}
/**
* @code 1487672276
*
* @param string $name
* @return self
*/
final public static function validatorNotFound($name)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::VALIDATOR_NOT_FOUND,
[$name, Field::class]
);
return $exception;
}
/**
* @code 1494685753
*
* @param string $name
* @return self
*/
final public static function behaviourNotFound($name)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::BEHAVIOUR_NOT_FOUND,
[$name, Field::class]
);
return $exception;
}
/**
* @code 1494694474
*
* @param string $name
* @return self
*/
final public static function messageNotFound($name)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::MESSAGE_NOT_FOUND,
[$name, Validator::class]
);
return $exception;
}
/**
* @code 1489753952
*
* @param string $name
* @return self
*/
final public static function viewLayoutNotFound($name)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::VIEW_LAYOUT_NOT_FOUND,
[$name, View::class]
);
return $exception;
}
/**
* @code 1489757511
*
* @param string $name
* @return self
*/
final public static function viewLayoutItemNotFound($name)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::VIEW_LAYOUT_ITEM_NOT_FOUND,
[$name, LayoutGroup::class]
);
return $exception;
}
/**
* @code 1489754909
*
* @param string $name
* @return self
*/
final public static function viewClassNotFound($name)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::VIEW_CLASS_NOT_FOUND,
[$name, ViewClass::class]
);
return $exception;
}
/**
* @code 1487672956
*
* @param string $validationName
* @param string $fieldName
* @return self
*/
final public static function ajaxControllerValidationNotFoundForField($validationName, $fieldName)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::VALIDATION_NOT_FOUND_FOR_FIELD,
[$fieldName, $validationName]
);
return $exception;
}
/**
* @code 1487671603
*
* @param string $fieldName
* @param FormObject $formObject
* @return self
*/
final public static function ajaxControllerFieldNotFound($fieldName, FormObject $formObject)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::FIELD_NOT_FOUND,
[$fieldName, $formObject->getName(), $formObject->getClassName()]
);
return $exception;
}
/**
* @code 1455272659
*
* @param string $key
* @param AbstractFieldValidator $validator
* @return self
*/
final public static function errorKeyNotFoundForValidator($key, AbstractFieldValidator $validator)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::ERROR_KEY_NOT_FOUND_FOR_VALIDATOR,
[$key, get_class($validator)]
);
return $exception;
}
/**
* @code 1487947224
*
* @param string $fieldName
* @param FormObject $formObject
* @return self
*/
final public static function equalsToFieldValidatorFieldNotFound($fieldName, FormObject $formObject)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::FIELD_NOT_FOUND,
[$fieldName, $formObject->getName(), $formObject->getClassName()]
);
return $exception;
}
/**
* @code 1467623761
*
* @return self
*/
final public static function classViewHelperFieldNotFound()
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::VIEW_HELPER_FIELD_NOT_FOUND,
[ClassViewHelper::class, FieldViewHelper::class]
);
return $exception;
}
/**
* @code 1467624152
*
* @param string $fieldName
* @return self
*/
final public static function formatMessageViewHelperFieldNotFound($fieldName)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::VIEW_HELPER_FIELD_NOT_FOUND,
[$fieldName, FormatMessageViewHelper::class, FieldViewHelper::class]
);
return $exception;
}
/**
* @code 1465243586
*
* @param string $layoutName
* @return self
*/
final public static function fieldViewHelperLayoutNotFound($layoutName)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::FIELD_VIEW_HELPER_LAYOUT_NOT_FOUND,
[$layoutName]
);
return $exception;
}
/**
* @code 1485867803
*
* @param string $layoutName
* @param string $itemName
* @return self
*/
final public static function fieldViewHelperLayoutItemNotFound($layoutName, $itemName)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::FIELD_VIEW_HELPER_LAYOUT_ITEM_NOT_FOUND,
[$layoutName, $itemName]
);
return $exception;
}
/**
* @code 1473084335
*
* @param string $fieldName
* @param FormObject $formObject
* @return self
*/
final public static function formatMessageViewHelperFieldNotFoundInForm($fieldName, FormObject $formObject)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::FIELD_NOT_FOUND,
[$fieldName, $formObject->getName(), $formObject->getClassName()]
);
return $exception;
}
/**
* @code 1457441846
*
* @param string $controllerObjectName
* @param string $actionName
* @param string $formName
* @return self
*/
final public static function controllerServiceActionFormArgumentMissing($controllerObjectName, $actionName, $formName)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::CONTROLLER_SERVICE_ACTION_FORM_ARGUMENT_MISSING,
[$controllerObjectName, $actionName . 'Action', $formName]
);
return $exception;
}
/**
* @code 1488988452
*
* @param string $name
* @return self
*/
final public static function slotClosureSlotNotFound($name)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::SLOT_NOT_FOUND,
[$name]
);
return $exception;
}
/**
* @code 1489497046
*
* @param string $name
* @return self
*/
final public static function slotArgumentsSlotNotFound($name)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::SLOT_NOT_FOUND,
[$name]
);
return $exception;
}
/**
* @code 1491997168
*
* @return self
*/
final public static function formConfigurationNotFound()
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::FORM_CONFIGURATION_NOT_FOUND,
[Configuration::class]
);
return $exception;
}
/**
* @code 1493881671
*
* @param string $name
* @return self
*/
final public static function conditionNotFoundInDefinition($name)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::CONDITION_NOT_FOUND_IN_DEFINITION,
[$name, Configuration::class]
);
return $exception;
}
/**
* @code 1494514957
*
* @param FormInterface $form
* @return self
*/
final public static function formObjectInstanceNotFound(FormInterface $form)
{
/** @var self $exception */
$exception = self::getNewExceptionInstance(
self::FORM_OBJECT_INSTANCE_NOT_FOUND,
[get_class($form), FormObjectFactory::class]
);
return $exception;
}
}