Skip to content

4.4. Upgrade Signal Slots

If you used Signal Slots to listen for events in you custom code, you need to rewrite them using Symfony Events and Listeners instead.

The application now triggers two Events per operation: one before and one after the relevant thing happens (see for example Bookmark events).

To use them, create Event Listeners in your code, for example:

Use:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
public static function getSubscribedEvents(): array
{
    return [
        CreateBookmarkEvent::class => 'onCreateBookmark',
    ]
}

public function onCreateBookmark(CreateBookmarkEvent $event): void
{
    /// your code
}

instead of:

1
2
3
4
5
6
7
8
public function receive(Signal $signal)
{
    if (!($signal instanceof CreateBookmarkSignal)) {
        return;
    }
}

// your code
Read the Docs