Skip to content

A Projector that listens to all ShouldBeStored Events #293

Answered by brendt
fabianpnke asked this question in Q&A
Discussion options

You must be logged in to vote

v6 allows you to listen to union types and even object :) a few variations:

class UserActivityProjector extends Projector implements ShouldQueue
{
    public function onAllEvents(ShouldBeStored $event)
    {
    }
}
class UserActivityProjector extends Projector implements ShouldQueue
{
    public function onAllEvents(object $event)
    {
    }
}
class UserActivityProjector extends Projector implements ShouldQueue
{
    public function onAllEvents(ActivityEvent|LoggableEvent $event)
    {
    }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fabianpnke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants