[FEATURE] Migrate various Signal Slots to PSR-14 events
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Compatibility / SlotReplacement.php
1 <?php
2 declare(strict_types = 1);
3
4 namespace TYPO3\CMS\Core\Compatibility;
5
6 /*
7 * This file is part of the TYPO3 CMS project.
8 *
9 * It is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, either version 2
11 * of the License, or any later version.
12 *
13 * For the full copyright and license information, please read the
14 * LICENSE.txt file that was distributed with this source code.
15 *
16 * The TYPO3 project - inspiring people to share!
17 */
18
19 use Psr\EventDispatcher\EventDispatcherInterface;
20 use TYPO3\CMS\Core\Configuration\Event\AfterTcaCompilationEvent;
21 use TYPO3\CMS\Core\Database\Event\AlterTableDefinitionStatementsEvent;
22 use TYPO3\CMS\Core\Database\ReferenceIndex;
23 use TYPO3\CMS\Core\Database\Schema\Exception\UnexpectedSignalReturnValueTypeException;
24 use TYPO3\CMS\Core\Database\Schema\SqlReader;
25 use TYPO3\CMS\Core\Database\SoftReferenceIndex;
26 use TYPO3\CMS\Core\DataHandling\Event\AppendLinkHandlerElementsEvent;
27 use TYPO3\CMS\Core\DataHandling\Event\IsTableExcludedFromReferenceIndexEvent;
28 use TYPO3\CMS\Core\Imaging\Event\ModifyIconForResourcePropertiesEvent;
29 use TYPO3\CMS\Core\Imaging\IconFactory;
30 use TYPO3\CMS\Core\Resource\Event\AfterFileAddedEvent;
31 use TYPO3\CMS\Core\Resource\Event\AfterFileAddedToIndexEvent;
32 use TYPO3\CMS\Core\Resource\Event\AfterFileContentsSetEvent;
33 use TYPO3\CMS\Core\Resource\Event\AfterFileCopiedEvent;
34 use TYPO3\CMS\Core\Resource\Event\AfterFileCreatedEvent;
35 use TYPO3\CMS\Core\Resource\Event\AfterFileDeletedEvent;
36 use TYPO3\CMS\Core\Resource\Event\AfterFileMarkedAsMissingEvent;
37 use TYPO3\CMS\Core\Resource\Event\AfterFileMetaDataCreatedEvent;
38 use TYPO3\CMS\Core\Resource\Event\AfterFileMetaDataDeletedEvent;
39 use TYPO3\CMS\Core\Resource\Event\AfterFileMetaDataUpdatedEvent;
40 use TYPO3\CMS\Core\Resource\Event\AfterFileMovedEvent;
41 use TYPO3\CMS\Core\Resource\Event\AfterFileProcessingEvent;
42 use TYPO3\CMS\Core\Resource\Event\AfterFileRemovedFromIndexEvent;
43 use TYPO3\CMS\Core\Resource\Event\AfterFileRenamedEvent;
44 use TYPO3\CMS\Core\Resource\Event\AfterFileReplacedEvent;
45 use TYPO3\CMS\Core\Resource\Event\AfterFileUpdatedInIndexEvent;
46 use TYPO3\CMS\Core\Resource\Event\AfterFolderAddedEvent;
47 use TYPO3\CMS\Core\Resource\Event\AfterFolderCopiedEvent;
48 use TYPO3\CMS\Core\Resource\Event\AfterFolderDeletedEvent;
49 use TYPO3\CMS\Core\Resource\Event\AfterFolderMovedEvent;
50 use TYPO3\CMS\Core\Resource\Event\AfterFolderRenamedEvent;
51 use TYPO3\CMS\Core\Resource\Event\AfterResourceStorageInitializationEvent;
52 use TYPO3\CMS\Core\Resource\Event\BeforeFileAddedEvent;
53 use TYPO3\CMS\Core\Resource\Event\BeforeFileContentsSetEvent;
54 use TYPO3\CMS\Core\Resource\Event\BeforeFileCopiedEvent;
55 use TYPO3\CMS\Core\Resource\Event\BeforeFileCreatedEvent;
56 use TYPO3\CMS\Core\Resource\Event\BeforeFileDeletedEvent;
57 use TYPO3\CMS\Core\Resource\Event\BeforeFileMovedEvent;
58 use TYPO3\CMS\Core\Resource\Event\BeforeFileProcessingEvent;
59 use TYPO3\CMS\Core\Resource\Event\BeforeFileRenamedEvent;
60 use TYPO3\CMS\Core\Resource\Event\BeforeFileReplacedEvent;
61 use TYPO3\CMS\Core\Resource\Event\BeforeFolderAddedEvent;
62 use TYPO3\CMS\Core\Resource\Event\BeforeFolderCopiedEvent;
63 use TYPO3\CMS\Core\Resource\Event\BeforeFolderDeletedEvent;
64 use TYPO3\CMS\Core\Resource\Event\BeforeFolderMovedEvent;
65 use TYPO3\CMS\Core\Resource\Event\BeforeFolderRenamedEvent;
66 use TYPO3\CMS\Core\Resource\Event\BeforeResourceStorageInitializationEvent;
67 use TYPO3\CMS\Core\Resource\Event\EnrichFileMetaDataEvent;
68 use TYPO3\CMS\Core\Resource\Event\GeneratePublicUrlForResourceEvent;
69 use TYPO3\CMS\Core\Resource\Event\SanitizeFileNameEvent;
70 use TYPO3\CMS\Core\Resource\Index\FileIndexRepository;
71 use TYPO3\CMS\Core\Resource\Index\MetaDataRepository;
72 use TYPO3\CMS\Core\Resource\ResourceFactory;
73 use TYPO3\CMS\Core\Resource\ResourceStorage;
74 use TYPO3\CMS\Core\Resource\Service\FileProcessingService;
75 use TYPO3\CMS\Core\Tree\Event\ModifyTreeDataEvent;
76 use TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider;
77 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
78 use TYPO3\CMS\Core\Utility\GeneralUtility;
79 use TYPO3\CMS\Extbase\SignalSlot\Dispatcher as SignalSlotDispatcher;
80
81 /**
82 * This class provides a replacement for all existing signals in TYPO3 Core, which now act as a simple wrapper
83 * for PSR-14 events with a simple ("first prioritized") listener implementation.
84 *
85 * @internal Please note that this class will likely be removed in TYPO3 v11, and Extension Authors should
86 * switch to PSR-14 event listeners.
87 */
88 class SlotReplacement
89 {
90 /**
91 * @var SignalSlotDispatcher
92 */
93 protected $signalSlotDispatcher;
94
95 /**
96 * @var EventDispatcherInterface
97 */
98 protected $eventDispatcher;
99
100 public function __construct(SignalSlotDispatcher $signalSlotDispatcher, EventDispatcherInterface $eventDispatcher)
101 {
102 $this->signalSlotDispatcher = $signalSlotDispatcher;
103 $this->eventDispatcher = $eventDispatcher;
104 }
105
106 public function onMetaDataRepositoryRecordPostRetrieval(EnrichFileMetaDataEvent $event): void
107 {
108 $data = $event->getRecord();
109 $data = new \ArrayObject($data);
110 $this->signalSlotDispatcher->dispatch(MetaDataRepository::class, 'recordPostRetrieval', [$data]);
111 $event->setRecord($data->getArrayCopy());
112 }
113
114 public function onMetaDataRepositoryRecordUpdated(AfterFileMetaDataUpdatedEvent $event): void
115 {
116 $this->signalSlotDispatcher->dispatch(MetaDataRepository::class, 'recordUpdated', [$event->getRecord()]);
117 }
118
119 public function onMetaDataRepositoryRecordCreated(AfterFileMetaDataCreatedEvent $event): void
120 {
121 $this->signalSlotDispatcher->dispatch(MetaDataRepository::class, 'recordCreated', [$event->getRecord()]);
122 }
123
124 public function onMetaDataRepositoryRecordDeleted(AfterFileMetaDataDeletedEvent $event): void
125 {
126 $this->signalSlotDispatcher->dispatch(MetaDataRepository::class, 'recordDeleted', [$event->getFileUid()]);
127 }
128
129 public function onFileIndexRepositoryRecordUpdated(AfterFileUpdatedInIndexEvent $event): void
130 {
131 $this->signalSlotDispatcher->dispatch(
132 FileIndexRepository::class,
133 'recordUpdated',
134 [$event->getRelevantProperties()]
135 );
136 }
137
138 public function onFileIndexRepositoryRecordCreated(AfterFileAddedToIndexEvent $event): void
139 {
140 $this->signalSlotDispatcher->dispatch(FileIndexRepository::class, 'recordCreated', [$event->getRecord()]);
141 }
142
143 public function onFileIndexRepositoryRecordMarkedAsMissing(AfterFileMarkedAsMissingEvent $event): void
144 {
145 $this->signalSlotDispatcher->dispatch(
146 FileIndexRepository::class,
147 'recordMarkedAsMissing',
148 [$event->getFileUid()]
149 );
150 }
151
152 public function onFileIndexRepositoryRecordDeleted(AfterFileRemovedFromIndexEvent $event): void
153 {
154 $this->signalSlotDispatcher->dispatch(FileIndexRepository::class, 'recordDeleted', [$event->getFileUid()]);
155 }
156
157 public function onResourceFactoryPreProcessStorage(BeforeResourceStorageInitializationEvent $event): void
158 {
159 [, $uid, $recordData, $fileIdentifier] = $this->signalSlotDispatcher->dispatch(
160 ResourceFactory::class,
161 'preProcessStorage',
162 [ResourceFactory::getInstance(), $event->getStorageUid(), $event->getRecord(), $event->getFileIdentifier()]
163 );
164 $event->setStorageUid($uid);
165 $event->setRecord($recordData);
166 $event->setFileIdentifier($fileIdentifier);
167 }
168
169 public function onResourceFactoryPostProcessStorage(AfterResourceStorageInitializationEvent $event): void
170 {
171 $this->signalSlotDispatcher->dispatch(
172 ResourceFactory::class,
173 'postProcessStorage',
174 [ResourceFactory::getInstance(), $event->getStorage()]
175 );
176 }
177
178 public function onFileProcessingServiceEmitPreFileProcessSignal(BeforeFileProcessingEvent $event): void
179 {
180 $service = GeneralUtility::makeInstance(
181 FileProcessingService::class,
182 $event->getFile()->getStorage(),
183 $event->getDriver(),
184 $this->eventDispatcher
185 );
186 $this->signalSlotDispatcher->dispatch(
187 ResourceStorage::class,
188 FileProcessingService::SIGNAL_PreFileProcess,
189 [
190 $service,
191 $event->getDriver(),
192 $event->getProcessedFile(),
193 $event->getFile(),
194 $event->getTaskType(),
195 $event->getConfiguration()
196 ]
197 );
198 }
199
200 public function onFileProcessingServiceEmitPostFileProcessSignal(AfterFileProcessingEvent $event): void
201 {
202 $service = GeneralUtility::makeInstance(
203 FileProcessingService::class,
204 $event->getFile()->getStorage(),
205 $event->getDriver(),
206 $this->eventDispatcher
207 );
208 $this->signalSlotDispatcher->dispatch(
209 ResourceStorage::class,
210 FileProcessingService::SIGNAL_PostFileProcess,
211 [
212 $service,
213 $event->getDriver(),
214 $event->getProcessedFile(),
215 $event->getFile(),
216 $event->getTaskType(),
217 $event->getConfiguration()
218 ]
219 );
220 }
221
222 public function onResourceStorageEmitSanitizeFileNameSignal(SanitizeFileNameEvent $event): void
223 {
224 list($fileName) = $this->signalSlotDispatcher->dispatch(
225 ResourceStorage::class,
226 ResourceStorage::SIGNAL_SanitizeFileName,
227 [
228 $event->getFileName(),
229 $event->getTargetFolder(),
230 $event->getStorage(),
231 $event->getDriver()
232 ]
233 );
234 $event->setFileName($fileName);
235 }
236
237 public function onResourceStorageEmitPreFileAddSignal(BeforeFileAddedEvent $event): void
238 {
239 $targetFileName = $event->getFileName();
240 $this->signalSlotDispatcher->dispatch(
241 ResourceStorage::class,
242 ResourceStorage::SIGNAL_PreFileAdd,
243 [
244 &$targetFileName,
245 $event->getTargetFolder(),
246 $event->getSourceFilePath(),
247 $event->getStorage(),
248 $event->getDriver()
249 ]
250 );
251 $event->setFileName($targetFileName);
252 }
253
254 public function onResourceStorageEmitPostFileAddSignal(AfterFileAddedEvent $event): void
255 {
256 $this->signalSlotDispatcher->dispatch(
257 ResourceStorage::class,
258 ResourceStorage::SIGNAL_PostFileAdd,
259 [
260 $event->getFile(),
261 $event->getFolder()
262 ]
263 );
264 }
265
266 public function onResourceStorageEmitPreFileCopySignal(BeforeFileCopiedEvent $event): void
267 {
268 $this->signalSlotDispatcher->dispatch(
269 ResourceStorage::class,
270 ResourceStorage::SIGNAL_PreFileCopy,
271 [
272 $event->getFile(),
273 $event->getFolder()
274 ]
275 );
276 }
277
278 public function onResourceStorageEmitPostFileCopySignal(AfterFileCopiedEvent $event): void
279 {
280 $this->signalSlotDispatcher->dispatch(
281 ResourceStorage::class,
282 ResourceStorage::SIGNAL_PostFileCopy,
283 [
284 $event->getFile(),
285 $event->getFolder()
286 ]
287 );
288 }
289
290 public function onResourceStorageEmitPreFileMoveSignal(BeforeFileMovedEvent $event): void
291 {
292 $this->signalSlotDispatcher->dispatch(
293 ResourceStorage::class,
294 ResourceStorage::SIGNAL_PreFileMove,
295 [
296 $event->getFile(),
297 $event->getFolder(),
298 $event->getTargetFileName()
299 ]
300 );
301 }
302
303 public function onResourceStorageEmitPostFileMoveSignal(AfterFileMovedEvent $event): void
304 {
305 $this->signalSlotDispatcher->dispatch(
306 ResourceStorage::class,
307 ResourceStorage::SIGNAL_PostFileMove,
308 [
309 $event->getFile(),
310 $event->getFolder(),
311 $event->getOriginalFolder()
312 ]
313 );
314 }
315
316 public function onResourceStorageEmitPreFileRenameSignal(BeforeFileRenamedEvent $event): void
317 {
318 $this->signalSlotDispatcher->dispatch(
319 ResourceStorage::class,
320 ResourceStorage::SIGNAL_PreFileRename,
321 [
322 $event->getFile(),
323 $event->getTargetFileName()
324 ]
325 );
326 }
327
328 public function onResourceStorageEmitPostFileRenameSignal(AfterFileRenamedEvent $event): void
329 {
330 $this->signalSlotDispatcher->dispatch(
331 ResourceStorage::class,
332 ResourceStorage::SIGNAL_PostFileRename,
333 [
334 $event->getFile(),
335 $event->getTargetFileName()
336 ]
337 );
338 }
339
340 public function onResourceStorageEmitPreFileReplaceSignal(BeforeFileReplacedEvent $event): void
341 {
342 $this->signalSlotDispatcher->dispatch(
343 ResourceStorage::class,
344 ResourceStorage::SIGNAL_PreFileReplace,
345 [
346 $event->getFile(),
347 $event->getLocalFilePath()
348 ]
349 );
350 }
351
352 public function onResourceStorageEmitPostFileReplaceSignal(AfterFileReplacedEvent $event): void
353 {
354 $this->signalSlotDispatcher->dispatch(
355 ResourceStorage::class,
356 ResourceStorage::SIGNAL_PostFileReplace,
357 [
358 $event->getFile(),
359 $event->getLocalFilePath()
360 ]
361 );
362 }
363
364 public function onResourceStorageEmitPreFileCreateSignal(BeforeFileCreatedEvent $event): void
365 {
366 $this->signalSlotDispatcher->dispatch(
367 ResourceStorage::class,
368 ResourceStorage::SIGNAL_PreFileCreate,
369 [
370 $event->getFileName(),
371 $event->getFolder()
372 ]
373 );
374 }
375
376 public function onResourceStorageEmitPostFileCreateSignal(AfterFileCreatedEvent $event): void
377 {
378 $this->signalSlotDispatcher->dispatch(
379 ResourceStorage::class,
380 ResourceStorage::SIGNAL_PostFileCreate,
381 [
382 $event->getFileName(),
383 $event->getFolder()
384 ]
385 );
386 }
387
388 public function onResourceStorageEmitPreFileDeleteSignal(BeforeFileDeletedEvent $event): void
389 {
390 $this->signalSlotDispatcher->dispatch(
391 ResourceStorage::class,
392 ResourceStorage::SIGNAL_PreFileDelete,
393 [
394 $event->getFile()
395 ]
396 );
397 }
398
399 public function onResourceStorageEmitPostFileDeleteSignal(AfterFileDeletedEvent $event): void
400 {
401 $this->signalSlotDispatcher->dispatch(
402 ResourceStorage::class,
403 ResourceStorage::SIGNAL_PostFileDelete,
404 [
405 $event->getFile()
406 ]
407 );
408 }
409
410 public function onResourceStorageEmitPreFileSetContentsSignal(BeforeFileContentsSetEvent $event): void
411 {
412 $this->signalSlotDispatcher->dispatch(
413 ResourceStorage::class,
414 ResourceStorage::SIGNAL_PreFileSetContents,
415 [
416 $event->getFile(),
417 $event->getContent()
418 ]
419 );
420 }
421
422 public function onResourceStorageEmitPostFileSetContentsSignal(AfterFileContentsSetEvent $event): void
423 {
424 $this->signalSlotDispatcher->dispatch(
425 ResourceStorage::class,
426 ResourceStorage::SIGNAL_PostFileSetContents,
427 [
428 $event->getFile(),
429 $event->getContent()
430 ]
431 );
432 }
433
434 public function onResourceStorageEmitPreFolderAddSignal(BeforeFolderAddedEvent $event): void
435 {
436 $this->signalSlotDispatcher->dispatch(
437 ResourceStorage::class,
438 ResourceStorage::SIGNAL_PreFolderAdd,
439 [
440 $event->getParentFolder(),
441 $event->getFolderName()
442 ]
443 );
444 }
445
446 public function onResourceStorageEmitPostFolderAddSignal(AfterFolderAddedEvent $event): void
447 {
448 $this->signalSlotDispatcher->dispatch(
449 ResourceStorage::class,
450 ResourceStorage::SIGNAL_PostFolderAdd,
451 [
452 $event->getFolder()
453 ]
454 );
455 }
456
457 public function onResourceStorageEmitPreFolderCopySignal(BeforeFolderCopiedEvent $event): void
458 {
459 $this->signalSlotDispatcher->dispatch(
460 ResourceStorage::class,
461 ResourceStorage::SIGNAL_PreFolderCopy,
462 [
463 $event->getFolder(),
464 $event->getTargetParentFolder(),
465 $event->getTargetFolderName()
466 ]
467 );
468 }
469
470 public function onResourceStorageEmitPostFolderCopySignal(AfterFolderCopiedEvent $event): void
471 {
472 $this->signalSlotDispatcher->dispatch(
473 ResourceStorage::class,
474 ResourceStorage::SIGNAL_PostFolderCopy,
475 [
476 $event->getFolder(),
477 $event->getTargetParentFolder(),
478 $event->getTargetFolder()->getName()
479 ]
480 );
481 }
482
483 public function onResourceStorageEmitPreFolderMoveSignal(BeforeFolderMovedEvent $event): void
484 {
485 $this->signalSlotDispatcher->dispatch(
486 ResourceStorage::class,
487 ResourceStorage::SIGNAL_PreFolderMove,
488 [
489 $event->getFolder(),
490 $event->getTargetParentFolder(),
491 $event->getTargetFolderName()
492 ]
493 );
494 }
495
496 public function onResourceStorageEmitPostFolderMoveSignal(AfterFolderMovedEvent $event): void
497 {
498 $this->signalSlotDispatcher->dispatch(
499 ResourceStorage::class,
500 ResourceStorage::SIGNAL_PostFolderMove,
501 [
502 $event->getFolder(),
503 $event->getTargetParentFolder(),
504 $event->getTargetFolder()->getName(),
505 $event->getFolder()->getParentFolder()
506 ]
507 );
508 }
509
510 public function onResourceStorageEmitPreFolderRenameSignal(BeforeFolderRenamedEvent $event): void
511 {
512 $this->signalSlotDispatcher->dispatch(
513 ResourceStorage::class,
514 ResourceStorage::SIGNAL_PreFolderRename,
515 [
516 $event->getFolder(),
517 $event->getTargetName()
518 ]
519 );
520 }
521
522 public function onResourceStorageEmitPostFolderRenameSignal(AfterFolderRenamedEvent $event): void
523 {
524 $this->signalSlotDispatcher->dispatch(
525 ResourceStorage::class,
526 ResourceStorage::SIGNAL_PostFolderRename,
527 [
528 $event->getFolder(),
529 $event->getFolder()->getName()
530 ]
531 );
532 }
533
534 public function onResourceStorageEmitPreFolderDeleteSignal(BeforeFolderDeletedEvent $event): void
535 {
536 $this->signalSlotDispatcher->dispatch(
537 ResourceStorage::class,
538 ResourceStorage::SIGNAL_PreFolderDelete,
539 [
540 $event->getFolder()
541 ]
542 );
543 }
544
545 public function onResourceStorageEmitPostFolderDeleteSignal(AfterFolderDeletedEvent $event): void
546 {
547 $this->signalSlotDispatcher->dispatch(
548 ResourceStorage::class,
549 ResourceStorage::SIGNAL_PostFolderDelete,
550 [
551 $event->getFolder()
552 ]
553 );
554 }
555
556 public function onResourceStorageEmitPreGeneratePublicUrlSignal(GeneratePublicUrlForResourceEvent $event): void
557 {
558 $publicUrl = $event->getPublicUrl();
559 $urlData = ['publicUrl' => &$publicUrl];
560 $this->signalSlotDispatcher->dispatch(
561 ResourceStorage::class,
562 ResourceStorage::SIGNAL_PreGeneratePublicUrl,
563 [
564 $event->getStorage(),
565 $event->getDriver(),
566 $event->getResource(),
567 $event->isRelativeToCurrentScript(),
568 $urlData
569 ]
570 );
571 $event->setPublicUrl($urlData['publicUrl']);
572 }
573
574 /**
575 * ReferenceIndex and SoftReferenceIndex
576 */
577 public function onReferenceIndexShouldExcludeTableFromReferenceIndexSignal(
578 IsTableExcludedFromReferenceIndexEvent $event
579 ): void {
580 $excludeTable = $event->isTableExcluded();
581 $this->signalSlotDispatcher->dispatch(
582 ReferenceIndex::class,
583 'shouldExcludeTableFromReferenceIndex',
584 [
585 $event->getTable(),
586 &$excludeTable
587 ]
588 );
589 if ($excludeTable) {
590 $event->markAsExcluded();
591 }
592 }
593
594 public function onSoftReferenceIndexSetTypoLinkPartsElementSignal(AppendLinkHandlerElementsEvent $event): void
595 {
596 $linkHandlerFound = false;
597 $result = $this->signalSlotDispatcher->dispatch(
598 SoftReferenceIndex::class,
599 'setTypoLinkPartsElement',
600 [
601 $linkHandlerFound,
602 $event->getLinkParts(),
603 $event->getContent(),
604 $event->getElements(),
605 $event->getIdx(),
606 $event->getTokenId()
607 ]
608 );
609 if ($result[0]) {
610 $event->setLinkParts($result[1]);
611 $event->setContent($result[2]);
612 $event->addElements($result[3]);
613 }
614 }
615
616 /**
617 * Imaging-related
618 */
619 public function onIconFactoryEmitBuildIconForResourceSignal(ModifyIconForResourcePropertiesEvent $event): void
620 {
621 $result = $this->signalSlotDispatcher->dispatch(
622 IconFactory::class,
623 'buildIconForResourceSignal',
624 [
625 $event->getResource(),
626 $event->getSize(),
627 $event->getOptions(),
628 $event->getIconIdentifier(),
629 $event->getOverlayIdentifier()
630 ]
631 );
632 $event->setIconIdentifier($result[3]);
633 $event->setOverlayIdentifier($result[4]);
634 }
635
636 public function onExtensionManagementUtilityTcaIsBeingBuilt(AfterTcaCompilationEvent $event): void
637 {
638 list($tca) = $this->signalSlotDispatcher->dispatch(
639 ExtensionManagementUtility::class,
640 'tcaIsBeingBuilt',
641 [
642 $event->getTca()
643 ]
644 );
645 $event->setTca($tca);
646 }
647
648 public function onSqlReaderEmitTablesDefinitionIsBeingBuiltSignal(AlterTableDefinitionStatementsEvent $event): void
649 {
650 // Using the old class name from the install tool here to keep backwards compatibility.
651 $signalReturn = $this->signalSlotDispatcher->dispatch(
652 'TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService',
653 'tablesDefinitionIsBeingBuilt',
654 [$event->getSqlData()]
655 );
656
657 // This is important to support old associated returns
658 $signalReturn = array_values($signalReturn);
659 $sqlString = $signalReturn[0];
660 if (!is_array($sqlString)) {
661 throw new UnexpectedSignalReturnValueTypeException(
662 sprintf(
663 'The signal %s of class %s returned a value of type %s, but array was expected.',
664 'tablesDefinitionIsBeingBuilt',
665 SqlReader::class,
666 gettype($sqlString)
667 ),
668 1382351456
669 );
670 }
671 $event->setSqlData($sqlString);
672 }
673
674 public function onDatabaseTreeDataProviderEmitPostProcessTreeDataSignal(ModifyTreeDataEvent $event): void
675 {
676 if ($event->getProvider() instanceof DatabaseTreeDataProvider) {
677 $this->signalSlotDispatcher->dispatch(
678 DatabaseTreeDataProvider::class,
679 'PostProcessTreeData',
680 [$event->getProvider(), $event->getTreeData()]
681 );
682 }
683 }
684 }