Symfony messenger support
As the title says, it would be good if Symfony messenger would be supported out of the box :)
Currently we are using a custom message and a message handler, but there's a slight problem that it doesn't properly work for the document removal part from the index. To do a reall ->remove call we use $objectManager->getReference().
But then the call is delegated to Engine and calls $entity->getSearchableArray(); but as the entity is already removed, doctrine throws error that the entity not found because proxy tries to load it's information to normalize the searchable array.
Sorry for being late to the party 😄
I would really like to see that implemented or implement on my own but I am lacking a bit the uses cases.
- Can you point me a bit towards the point in code where you have problems with your current solution?
- So each of these three events,
postPersist,postUpdate,preRemove, should dispatch a message that can be consumed by a custom handler, that can be speci, right?
@codedge sorry, forgot to reply :slightly_smiling_face:
- The problem is that the document removal should be called with
postRemoveevent notpreRemove, because if doctrine would fail to delete the document would be lost. - Yes :)
Sound good. I'll implement that, as it would make to usage of the package more attractive and open for more custom events per project/user with custom handlers.
Awesome!
@norkunas Just added a small fix to the current situation: You can now enable the postRemove doctrine event (and disable the preRemove).
The next thing is the Messenger integration.
What about dispatching internal bundle event instead? And let external code listen/subscribe and do the job
I'd say by default listen on doctrine events and add an option to enable messenger :)