Skip to content

Commit 188cfc4

Browse files
committed
Also update default configuration
1 parent 6ac2173 commit 188cfc4

6 files changed

Lines changed: 46 additions & 21 deletions

File tree

docs/pages/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ For this you need to enable the crypto shredding.
672672
```yaml
673673
patchlevel_event_sourcing:
674674
cryptography:
675-
use_encrypted_field_name: true,
675+
use_encrypted_field_name: true
676676
```
677677

678678
!!! tip

docs/pages/installation.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,18 @@ patchlevel_event_sourcing:
3939
provide_dedicated_connection: true
4040
store:
4141
type: dbal_stream
42-
merge_orm_schema: true
42+
# if you are using doctrine bundle you should enable this
43+
#merge_orm_schema: true
4344
command_bus:
44-
service: messenger.bus.default
45+
service: messenger.default_bus
4546
query_bus:
46-
service: messenger.bus.default
47-
cryptography: ~
47+
service: messenger.default_bus
48+
subscription:
49+
gap_detection: ~
50+
51+
# enable this if you want to use sensitive data encryption
52+
#cryptography: ~
53+
# use_encrypted_field_name: true
4854

4955
when@dev:
5056
patchlevel_event_sourcing:

src/DependencyInjection/CommandHandlerCompilerPass.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ public function process(ContainerBuilder $container): void
2525
return;
2626
}
2727

28-
$bus = $container->getParameter('patchlevel_event_sourcing.aggregate_handlers.bus');
28+
$bus = ServiceAliasResolver::resolve(
29+
$container,
30+
$container->getParameter('patchlevel_event_sourcing.aggregate_handlers.bus'),
31+
);
2932

3033
/** @var AggregateRootRegistry $aggregateRootRegistry */
3134
$aggregateRootRegistry = $container->get(AggregateRootRegistry::class);

src/DependencyInjection/QueryHandlerCompilerPass.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ public function process(ContainerBuilder $container): void
1919
return;
2020
}
2121

22-
$bus = $container->getParameter('patchlevel_event_sourcing.query_handlers.bus');
22+
$bus = ServiceAliasResolver::resolve(
23+
$container,
24+
$container->getParameter('patchlevel_event_sourcing.query_handlers.bus'),
25+
);
2326
$subscribers = $container->findTaggedServiceIds('event_sourcing.subscriber');
2427

2528
foreach (array_keys($subscribers) as $subscriberServiceName) {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Patchlevel\EventSourcingBundle\DependencyInjection;
6+
7+
use Symfony\Component\DependencyInjection\ContainerBuilder;
8+
9+
/**
10+
* @interal
11+
*/
12+
final readonly class ServiceAliasResolver
13+
{
14+
public static function resolve(ContainerBuilder $container, string $id): string
15+
{
16+
if ($container->hasAlias($id)) {
17+
return self::resolve(
18+
$container,
19+
(string)$container->getAlias($id),
20+
);
21+
}
22+
23+
return $id;
24+
}
25+
}

src/DependencyInjection/SubscriberGuardCompilePass.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function process(ContainerBuilder $container): void
3434
);
3535
}
3636

37-
$subscriptionConnection = $this->resolveService($container, (string)$argument);
37+
$subscriptionConnection = ServiceAliasResolver::resolve($container, (string)$argument);
3838

3939
$subscribers = $container->findTaggedServiceIds('event_sourcing.subscriber');
4040

@@ -48,7 +48,7 @@ public function process(ContainerBuilder $container): void
4848
continue;
4949
}
5050

51-
if ($subscriptionConnection !== $this->resolveService($container, (string)$argument)) {
51+
if ($subscriptionConnection !== ServiceAliasResolver::resolve($container, (string)$argument)) {
5252
continue;
5353
}
5454

@@ -68,16 +68,4 @@ public function process(ContainerBuilder $container): void
6868
}
6969
}
7070
}
71-
72-
private function resolveService(ContainerBuilder $container, string $id): string
73-
{
74-
if ($container->hasAlias($id)) {
75-
return $this->resolveService(
76-
$container,
77-
(string)$container->getAlias($id),
78-
);
79-
}
80-
81-
return $id;
82-
}
8371
}

0 commit comments

Comments
 (0)