Closed dogawaf closed 1 year ago
@dogawaf Thanks for your report, we will look into it. Do you have some more information about where to change the signal?
Hello
Here is a working patch:
--- a/Classes/SignalSlot/EmitSignalTrait.php 2022-11-23 20:29:43.074846382 +0100
+++ v/Classes/SignalSlot/EmitSignalTrait.php 2022-11-23 20:15:56.136000000 +0100
@@ -45,9 +45,7 @@
{
if ($this->signalSlotDispatcher === null) {
$this->signalSlotDispatcher = GeneralUtility::makeInstance(
- Dispatcher::class,
- GeneralUtility::makeInstance(ObjectManager::class),
- GeneralUtility::makeInstance(Logger::class, 'PxaSocialFeed')
+ Dispatcher::class
);
}
Describe the bug Unable to use signal/slot: the slot is never called.
To Reproduce
Register a slot in your ext_localconf.php:
Then import a twitter feed.
Expected behavior
The registered slot should be called if the feed creates/updates a tweet. It is not.
Additional context
The issue is with DI and the way the Dispatcher is instanciated in
\Pixelant\PxaSocialFeed\SignalSlot\EmitSignalTrait::getSignalSlotDispatcher()
In the
ext_localconf.php
, no constructor argument is passed toGeneralUtility::makeInstance
. This way, the DI will use the symfony container, and the singleton will stay in it.But, when the signal is emitted and the Dispatcher is retreived in
\EmitSignalTrait::getSignalSlotDispatcher()
, some constructor arguments are passed toGeneralUtility::makeInstance
, and the singleton will be retreive fromGeneralUtility::$singletonInstances
.To fix it, the Dispatcher should be instanciated with no constructor arguments in
\EmitSignalTrait::getSignalSlotDispatcher()
, in order to get the singleton from the symfony container.