apisearch-io / apisearch-bundle

:boat: Apisearch Symfony-Drift Bundle
http://apisearch.io
MIT License
23 stars 4 forks source link

Added autowiring support #52

Closed mmoreram closed 4 years ago

mmoreram commented 4 years ago

Having an apisearch configuration like this one

apisearch:
    repositories:
        repo1:
            indices:
                index1: xxx

You can inject by autowiring the repositories as it follows. Because you can have multiple instances of the same interface, you must use named aliases, so it means that you will have to couple both layers

public function __construct(
    AppRepository $apisearchRepo1AppRepository,
    UserRepository $apisearchRepo1UserRepository,
    Repository $apisearchRepo1Index1Repository
)
mmoreram commented 4 years ago

Solves #51