2828use TYPO3 \CMS \Extbase \Configuration \ConfigurationManagerInterface ;
2929use TYPO3 \CMS \Extbase \Http \ForwardResponse ;
3030use TYPO3 \CMS \Extbase \Mvc \Controller \ActionController ;
31- use TYPO3 \CMS \Form \Mvc \Persistence \FormPersistenceManagerInterface ;
3231
33- class EventController extends ActionController
32+ final class EventController extends ActionController
3433{
3534 private Cart $ cart ;
3635
@@ -118,6 +117,10 @@ public function showAction(?Event $event = null): ResponseInterface
118117 #[IgnoreValidation(['value ' => 'priceCategory ' ])]
119118 public function formAction (?EventDate $ eventDate = null , ?PriceCategory $ priceCategory = null ): ResponseInterface
120119 {
120+ if (class_exists (\TYPO3 \CMS \Form \Mvc \Persistence \FormPersistenceManagerInterface::class) === false ) {
121+ throw new \BadFunctionCallException ('This action requires the installation of typo3/cms-form. ' );
122+ }
123+
121124 if (!$ eventDate ) {
122125 $ arguments = $ this ->request ->getArguments ();
123126 foreach ($ arguments as $ argumentKey => $ argumentValue ) {
@@ -133,7 +136,7 @@ public function formAction(?EventDate $eventDate = null, ?PriceCategory $priceCa
133136
134137 $ formDefinition = $ eventDate ->getEvent ()->getFormDefinition ();
135138 $ formPersistenceManager = GeneralUtility::makeInstance (
136- FormPersistenceManagerInterface::class
139+ \ TYPO3 \ CMS \ Form \ Mvc \ Persistence \ FormPersistenceManagerInterface::class
137140 );
138141 $ form = $ formPersistenceManager ->load ($ formDefinition );
139142
@@ -195,28 +198,7 @@ public function formAction(?EventDate $eventDate = null, ?PriceCategory $priceCa
195198 return $ this ->htmlResponse ();
196199 }
197200
198- protected function getEvent (): ?Event
199- {
200- $ eventUid = 0 ;
201-
202- if ((int )$ GLOBALS ['TSFE ' ]->page ['doktype ' ] == 186 ) {
203- $ eventUid = (int )$ GLOBALS ['TSFE ' ]->page ['cart_events_event ' ];
204- }
205-
206- if ($ eventUid > 0 ) {
207- $ event = $ this ->eventRepository ->findByUid ($ eventUid );
208- if ($ event && $ event instanceof Event) {
209- return $ event ;
210- }
211- }
212-
213- return null ;
214- }
215-
216- /**
217- * Create the demand object which define which records will get shown
218- */
219- protected function createDemandObjectFromSettings (string $ type , array $ settings ): EventDemand
201+ private function createDemandObjectFromSettings (string $ type , array $ settings ): EventDemand
220202 {
221203 /** @var EventDemand $demand */
222204 $ demand = GeneralUtility::makeInstance (
@@ -254,7 +236,7 @@ protected function createDemandObjectFromSettings(string $type, array $settings)
254236 return $ demand ;
255237 }
256238
257- protected function addCategoriesToDemandObjectFromSettings (EventDemand &$ demand ): void
239+ private function addCategoriesToDemandObjectFromSettings (EventDemand &$ demand ): void
258240 {
259241 if ($ this ->settings ['categoriesList ' ]) {
260242 $ selectedCategories = GeneralUtility::intExplode (
@@ -281,10 +263,7 @@ protected function addCategoriesToDemandObjectFromSettings(EventDemand &$demand)
281263 }
282264 }
283265
284- /**
285- * assigns currency translation array to view
286- */
287- protected function assignCurrencyTranslationData (): void
266+ private function assignCurrencyTranslationData (): void
288267 {
289268 $ this ->restoreSession ();
290269
@@ -297,7 +276,7 @@ protected function assignCurrencyTranslationData(): void
297276 $ this ->view ->assign ('currencyTranslationData ' , $ currencyTranslationData );
298277 }
299278
300- protected function addCacheTags (iterable $ events ): void
279+ private function addCacheTags (iterable $ events ): void
301280 {
302281 $ cacheTags = [];
303282
@@ -333,7 +312,7 @@ private function forwardToShowActionWhenRequested(): ?ForwardResponse
333312 return $ forwardResponse ->withArguments (['event ' => $ this ->request ->getArgument ('event ' )]);
334313 }
335314
336- protected function restoreSession (): void
315+ private function restoreSession (): void
337316 {
338317 $ cart = $ this ->sessionHandler ->restoreCart ($ this ->cartConfiguration ['settings ' ]['cart ' ]['pid ' ]);
339318
0 commit comments