Skip to content

Commit 7734566

Browse files
authored
Merge pull request #156 from patchlevel/upgrade-to-beta7
upgrade to beta7
2 parents 7c07f72 + e5c58cc commit 7734566

File tree

10 files changed

+344
-23
lines changed

10 files changed

+344
-23
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
],
2020
"require": {
2121
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
22-
"patchlevel/event-sourcing": "3.0.0-beta6",
22+
"patchlevel/event-sourcing": "3.0.0-beta7",
2323
"symfony/config": "^5.4.31|^6.4.0|^7.0.0",
2424
"symfony/console": "^5.4.32|^6.4.1|^7.0.1",
2525
"symfony/dependency-injection": "^5.4.33|^6.4.1|^7.0.1",

composer.lock

Lines changed: 244 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/DependencyInjection/PatchlevelEventSourcingExtension.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\Migrations\Tools\Console\Command\ExecuteCommand;
1717
use Doctrine\Migrations\Tools\Console\Command\MigrateCommand;
1818
use Doctrine\Migrations\Tools\Console\Command\StatusCommand;
19+
use Patchlevel\EventSourcing\Attribute\Projector;
1920
use Patchlevel\EventSourcing\Clock\FrozenClock;
2021
use Patchlevel\EventSourcing\Clock\SystemClock;
2122
use Patchlevel\EventSourcing\Console\Command\DatabaseCreateCommand;
@@ -55,7 +56,6 @@
5556
use Patchlevel\EventSourcing\Projection\Projectionist\SyncProjectionistEventBusWrapper;
5657
use Patchlevel\EventSourcing\Projection\Projector\InMemoryProjectorRepository;
5758
use Patchlevel\EventSourcing\Projection\Projector\MetadataProjectorResolver;
58-
use Patchlevel\EventSourcing\Projection\Projector\Projector;
5959
use Patchlevel\EventSourcing\Projection\Projector\ProjectorRepository;
6060
use Patchlevel\EventSourcing\Projection\Projector\ProjectorResolver;
6161
use Patchlevel\EventSourcing\Repository\DefaultRepositoryManager;
@@ -93,6 +93,7 @@
9393
use Patchlevel\Hydrator\MetadataHydrator;
9494
use Psr\Log\LoggerInterface;
9595
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
96+
use Symfony\Component\DependencyInjection\ChildDefinition;
9697
use Symfony\Component\DependencyInjection\ContainerBuilder;
9798
use Symfony\Component\DependencyInjection\ContainerInterface;
9899
use Symfony\Component\DependencyInjection\Reference;
@@ -208,8 +209,12 @@ private function configureEventBus(array $config, ContainerBuilder $container):
208209
/** @param Config $config */
209210
private function configureProjection(array $config, ContainerBuilder $container): void
210211
{
211-
$container->registerForAutoconfiguration(Projector::class)
212-
->addTag('event_sourcing.projector');
212+
$container->registerAttributeForAutoconfiguration(
213+
Projector::class,
214+
static function (ChildDefinition $definition): void {
215+
$definition->addTag('event_sourcing.projector');
216+
},
217+
);
213218

214219
$container->register(InMemoryProjectorRepository::class)
215220
->setArguments([

tests/Fixtures/CreatedSubscriber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace Patchlevel\EventSourcingBundle\Tests\Fixtures;
44

5-
use Patchlevel\EventSourcing\Attribute\Handle;
5+
use Patchlevel\EventSourcing\Attribute\Subscribe;
66
use Patchlevel\EventSourcing\EventBus\Message;
77
use Patchlevel\EventSourcing\EventBus\Subscriber;
88

99
class CreatedSubscriber extends Subscriber
1010
{
11-
#[Handle(ProfileCreated::class)]
11+
#[Subscribe(ProfileCreated::class)]
1212
public function onProfileCreated(Message $message): void
1313
{
1414
// do nothing

tests/Fixtures/Profile.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
namespace Patchlevel\EventSourcingBundle\Tests\Fixtures;
44

55
use Patchlevel\EventSourcing\Aggregate\BasicAggregateRoot;
6+
use Patchlevel\EventSourcing\Aggregate\CustomId;
67
use Patchlevel\EventSourcing\Attribute\Aggregate;
78
use Patchlevel\EventSourcing\Attribute\Apply;
9+
use Patchlevel\EventSourcing\Attribute\Id;
810

911
#[Aggregate('profile')]
1012
class Profile extends BasicAggregateRoot
1113
{
12-
public function aggregateRootId(): string
13-
{
14-
return '1';
15-
}
14+
#[Id]
15+
private CustomId $id;
1616

1717
#[Apply]
1818
protected function applyProfileCreated(ProfileCreated $event): void

tests/Fixtures/ProfileCreated.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
namespace Patchlevel\EventSourcingBundle\Tests\Fixtures;
44

5+
use Patchlevel\EventSourcing\Aggregate\CustomId;
56
use Patchlevel\EventSourcing\Attribute\Event;
7+
use Patchlevel\EventSourcing\Serializer\Normalizer\IdNormalizer;
68

79
#[Event('profile.created')]
810
class ProfileCreated
911
{
1012
public function __construct(
11-
public string $id
13+
#[IdNormalizer(CustomId::class)]
14+
public CustomId $id
1215
) {
1316

1417
}

0 commit comments

Comments
 (0)