I guess I'm missing something in the documentation, but the question is pretty simple.
Let's say I have a message of class MessageOne
and MessageTwo
which extends MessageOne
.
I also have MessageOneHandler
which should handle MessageOne
:
__invoke(MessageOne $messageOne)
And MessageTwoHandler
which should handle only MessageTwo
:
__invoke(MessageTwo $messageTwo)
And the problem is when MessageTwo
is dispatched it is being handled by both MessageHandlerOne
and MessageHandlerTwo
. Yes, it is completely sensible due to inheritance and everything is logically correct, but are there any "symfony" ways to prevent that?
Of course, I can solve this issue by reworking of the inheritance of these classes, but is there maybe a better way?
Moreover debug:messenger
shows everything as expected, one handler per one message class without inheritance issues.