-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Services are no longer public, added plugins service locator, introdu…
…ced test aliases
- Loading branch information
1 parent
862bc60
commit 4479ab1
Showing
13 changed files
with
116 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Prooph\Bundle\EventStore\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Definition; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
use Symfony\Component\DependencyInjection\ServiceLocator; | ||
|
||
final class PluginLocatorPass implements CompilerPassInterface | ||
{ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->hasParameter('prooph_event_store.stores')) { | ||
return; | ||
} | ||
|
||
$stores = $container->getParameter('prooph_event_store.stores'); | ||
|
||
$globalPlugins = $container->findTaggedServiceIds('prooph_event_store.plugin'); | ||
$storePlugins = []; | ||
|
||
foreach ($stores as $name => $store) { | ||
$storePlugins[] = $container->findTaggedServiceIds(sprintf('prooph_event_store.%s.plugin', $name)); | ||
} | ||
|
||
$plugins = array_merge($globalPlugins, ...$storePlugins); | ||
|
||
$locatorPlugins = []; | ||
|
||
foreach ($plugins as $id => $attributes) { | ||
$locatorPlugins[$id] = new ServiceClosureArgument(new Reference($id)); | ||
} | ||
|
||
$container | ||
->setDefinition( | ||
'prooph_event_store.plugins_locator', | ||
new Definition(ServiceLocator::class, [$locatorPlugins]) | ||
) | ||
->addTag('container.service_locator'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
services: | ||
'ProophTest\Bundle\EventStore\DependencyInjection\Fixture\Metadata\BlackHole': | ||
class: ProophTest\Bundle\EventStore\DependencyInjection\Fixture\Metadata\BlackHole | ||
public: true | ||
tags: | ||
- { name: 'prooph_event_store.main_store.metadata_enricher' } | ||
|
||
'ProophTest\Bundle\EventStore\DependencyInjection\Fixture\Metadata\GlobalBlackHole': | ||
class: ProophTest\Bundle\EventStore\DependencyInjection\Fixture\Metadata\GlobalBlackHole | ||
public: true | ||
tags: | ||
- { name: 'prooph_event_store.metadata_enricher' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
imports: | ||
- { resource: test_aliases.yml } | ||
|
||
services: | ||
'ProophTest\Bundle\EventStore\DependencyInjection\Fixture\EventStore\BlackHole': | ||
class: ProophTest\Bundle\EventStore\DependencyInjection\Fixture\EventStore\BlackHole | ||
public: true | ||
|
||
'prooph_test.bundle.snapshot_store.in_memory': | ||
class: Prooph\SnapshotStore\InMemorySnapshotStore | ||
public: true | ||
|
||
'ProophTest\Bundle\EventStore\DependencyInjection\Fixture\Model\BlackHoleAggregateTranslator': | ||
class: ProophTest\Bundle\EventStore\DependencyInjection\Fixture\Model\BlackHoleAggregateTranslator | ||
public: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
services: | ||
test.prooph_event_store.main_store: | ||
alias: prooph_event_store.main_store | ||
public: true | ||
|
||
test.prooph_event_store.second_store: | ||
alias: prooph_event_store.second_store | ||
public: true | ||
|
||
test.prooph_event_store.metadata_enricher_plugin.main_store: | ||
alias: prooph_event_store.metadata_enricher_plugin.main_store | ||
public: true | ||
|
||
test.prooph_event_store.metadata_enricher_aggregate.main_store: | ||
alias: prooph_event_store.metadata_enricher_aggregate.main_store | ||
public: true | ||
|
||
test.todo_list: | ||
alias: todo_list | ||
public: true | ||
|
||
test.main_store.todo_list: | ||
alias: main_store.todo_list | ||
public: true | ||
|
||
test.second_store.todo_list: | ||
alias: second_store.todo_list | ||
public: true | ||
|
||
test.ProophTest\Bundle\EventStore\DependencyInjection\Fixture\Model\BlackHoleRepository: | ||
alias: ProophTest\Bundle\EventStore\DependencyInjection\Fixture\Model\BlackHoleRepository | ||
public: true | ||
|
||
test.prooph_test.bundle.snapshot_store.in_memory: | ||
alias: prooph_test.bundle.snapshot_store.in_memory | ||
public: true |