-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Signal/Slots to PSR-14 EventDispatcher with backwards compati…
…bility
- Loading branch information
1 parent
84b09a2
commit a667843
Showing
6 changed files
with
114 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
namespace Medienreaktor\FormDoubleOptIn\Compatibility; | ||
|
||
use Medienreaktor\FormDoubleOptIn\Controller\DoubleOptInController; | ||
use Medienreaktor\FormDoubleOptIn\Domain\Finishers\DoubleOptInFormFinisher; | ||
use Medienreaktor\FormDoubleOptIn\Domain\Model\OptIn; | ||
use Medienreaktor\FormDoubleOptIn\Event\AfterOptInCreationEvent; | ||
use Medienreaktor\FormDoubleOptIn\Event\AfterOptInValidationEvent; | ||
use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; | ||
|
||
class SlotReplacement | ||
{ | ||
|
||
/** | ||
* signalSlotDispatcher | ||
* | ||
* @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher | ||
*/ | ||
protected $signalSlotDispatcher; | ||
|
||
public function injectSignalSlotDispatcher(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $dispatcher): void | ||
{ | ||
$this->signalSlotDispatcher = $dispatcher; | ||
} | ||
|
||
public function onOptInRecordCreated(AfterOptInCreationEvent $event): void | ||
{ | ||
$this->signalSlotDispatcher->dispatch(DoubleOptInFormFinisher::class, 'afterOptInCreation', [$event->getOptIn()]); | ||
} | ||
|
||
public function onOptInRecordValidated(AfterOptInValidationEvent $event): void | ||
{ | ||
$this->signalSlotDispatcher->dispatch(DoubleOptInController::class, 'afterOptInValidation', [$event->getOptIn()]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace Medienreaktor\FormDoubleOptIn\Event; | ||
|
||
use Medienreaktor\FormDoubleOptIn\Domain\Model\OptIn; | ||
|
||
/** | ||
* Event after OptIn record has been created. | ||
*/ | ||
final class AfterOptInCreationEvent | ||
{ | ||
|
||
/** | ||
* @var \Medienreaktor\FormDoubleOptIn\Domain\Model\OptIn | ||
*/ | ||
private $optIn; | ||
|
||
public function __construct(\Medienreaktor\FormDoubleOptIn\Domain\Model\OptIn $optIn) | ||
{ | ||
$this->optIn = $optIn; | ||
} | ||
|
||
public function getOptIn() | ||
{ | ||
return $this->optIn; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace Medienreaktor\FormDoubleOptIn\Event; | ||
|
||
use Medienreaktor\FormDoubleOptIn\Domain\Model\OptIn; | ||
|
||
/** | ||
* Event after OptIn record has been validated. | ||
*/ | ||
final class AfterOptInValidationEvent | ||
{ | ||
|
||
/** | ||
* @var \Medienreaktor\FormDoubleOptIn\Domain\Model\OptIn | ||
*/ | ||
private $optIn; | ||
|
||
public function __construct(\Medienreaktor\FormDoubleOptIn\Domain\Model\OptIn $optIn) | ||
{ | ||
$this->optIn = $optIn; | ||
} | ||
|
||
public function getOptIn() | ||
{ | ||
return $this->optIn; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters