Closed gquemener closed 3 years ago
Today, there are two ways to define aggregate repositories using this bundle:
prooph_event_store: stores: user_store: event_store: 'app.event_store.default' repositories: user_collection: repository_class: App\Infrastructure\User\Repository\EventStoreUserCollection
and
prooph_event_store: stores: user_store: event_store: 'app.event_store.default' repositories: App\Infrastructure\User\Repository\EventStoreUserCollection: ~
The later has the huge benefit of allowing autowiring to work out of the box.
As a matter of fact, the repositories key will be used as the service id and this is not obvious from a developer perspective.
repositories
The result will be that developers will get an error stating than the EventStoreUserCollection argument cannot be autowired when using the first form.
EventStoreUserCollection
It is still doable though, through a service alias:
services: App\Infrastructure\User\Repository\EventStoreUserCollection: '@user_collection`
Remove the first form, aka force the repository service id to be a FQCN, thus making the autowiring always work.
The issue appeared to me while reviewing this PR
Starting from 0.9.x, this bundle no longer handle repositories
The "problem"
Today, there are two ways to define aggregate repositories using this bundle:
and
The later has the huge benefit of allowing autowiring to work out of the box.
As a matter of fact, the
repositories
key will be used as the service id and this is not obvious from a developer perspective.The result will be that developers will get an error stating than the
EventStoreUserCollection
argument cannot be autowired when using the first form.It is still doable though, through a service alias:
The suggestion
Remove the first form, aka force the repository service id to be a FQCN, thus making the autowiring always work.
The source
The issue appeared to me while reviewing this PR