(feat): DocumentDataProvider to allow external data sources #121
Labels
enhancement
New feature or request
needs opinion
Ask for the community opinion on a topic/enhancement
Description
Hi everyone 👋🏻
Small suggestion here that can help the bundle supporting extra document data sources, for now, this bundle only support loading document data from entities (without asynchronous supports but more on this later), even if this is the de facto approach when it comes to data handling in Symfony application (thanks to Doctrine), we often use external services like Redis, Kafka and so on, these services contains data and we often need to search on it.
The idea here is to introduce the idea of
DocumentDataProvider
(or just_X_DataProvider
) along with aDataProviderRegistry
which allow to use the data providers and allow each provider to return an array that contains data that we can load into indexes.Basic example
Ok, so, here's a small example:
Following the same approach, an
EntityDataProvider
can be created to move the logic from the existing command to a dedicated class.The final part is a
DataProviderRegistry
which contains and allow to access and interact with the data providers (sort them, filter them and many more) which can be injected in the command to remove some logic on it and ease both the debug and evolution phase.Regarding the asynchronous support, when using Messenger and regarding #62, adding this layer can help introduce the asynchronous support by allowing to dispatch a message which can call the registry to persist data into MS.
I've already implemented a solution here but the final implementation can be improved 🙂
Other
--
Thanks for the feedback and have a great day 🙂
The text was updated successfully, but these errors were encountered: