1 | <?php |
||
34 | class FormHelper { |
||
35 | |||
36 | use EventDispatcherTrait; |
||
37 | use ObjectManagerTrait; |
||
38 | |||
39 | /** |
||
40 | * Service name. |
||
41 | * |
||
42 | * @avr string |
||
43 | */ |
||
44 | const SERVICE_NAME = "wbw.core.helper.form"; |
||
45 | |||
46 | /** |
||
47 | * Constructor. |
||
48 | * |
||
49 | * @param ObjectManager $objectManager The object manager. |
||
50 | * @param EventDispatcherInterface $eventDispatcher The event dispatcher. |
||
51 | */ |
||
52 | public function __construct(ObjectManager $objectManager, EventDispatcherInterface $eventDispatcher) { |
||
56 | |||
57 | /** |
||
58 | * Check a collection. |
||
59 | * |
||
60 | * @param Countable $collection The collection. |
||
61 | * @param string $notification The notification. |
||
62 | * @param string $redirectURL The redirect URL. |
||
63 | * @param int $expected The expected count. |
||
64 | * @throws InvalidArgumentException Throws an invalid argument exception if collection is null. |
||
65 | * @throws RedirectResponseException Throws a redirect response exception if the collection is less than $expected. |
||
66 | */ |
||
67 | public function checkCollection($collection, $notification, $redirectURL, $expected = 1) { |
||
84 | |||
85 | /** |
||
86 | * On post handle request with collection. |
||
87 | * |
||
88 | * @param Collection $oldCollection The old collection. |
||
89 | * @param Collection $newCollection The new collection. |
||
90 | * @return int Returns the deleted count. |
||
91 | */ |
||
92 | public function onPostHandleRequestWithCollection(Collection $oldCollection, Collection $newCollection) { |
||
103 | |||
104 | /** |
||
105 | * On pre handle request with collection. |
||
106 | * |
||
107 | * @param Collection $collection The collection. |
||
108 | * @return Collection Returns the cloned collection. |
||
109 | */ |
||
110 | public function onPreHandleRequestWithCollection(Collection $collection) { |
||
117 | } |
||
118 |