Skip to content

Commit

Permalink
Merge pull request #156 from patchlevel/upgrade-to-beta7
Browse files Browse the repository at this point in the history
upgrade to beta7
  • Loading branch information
DavidBadura authored Jan 3, 2024
2 parents 7c07f72 + e5c58cc commit 7734566
Show file tree
Hide file tree
Showing 10 changed files with 344 additions and 23 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"patchlevel/event-sourcing": "3.0.0-beta6",
"patchlevel/event-sourcing": "3.0.0-beta7",
"symfony/config": "^5.4.31|^6.4.0|^7.0.0",
"symfony/console": "^5.4.32|^6.4.1|^7.0.1",
"symfony/dependency-injection": "^5.4.33|^6.4.1|^7.0.1",
Expand Down
251 changes: 244 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/DependencyInjection/PatchlevelEventSourcingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Doctrine\Migrations\Tools\Console\Command\ExecuteCommand;
use Doctrine\Migrations\Tools\Console\Command\MigrateCommand;
use Doctrine\Migrations\Tools\Console\Command\StatusCommand;
use Patchlevel\EventSourcing\Attribute\Projector;
use Patchlevel\EventSourcing\Clock\FrozenClock;
use Patchlevel\EventSourcing\Clock\SystemClock;
use Patchlevel\EventSourcing\Console\Command\DatabaseCreateCommand;
Expand Down Expand Up @@ -55,7 +56,6 @@
use Patchlevel\EventSourcing\Projection\Projectionist\SyncProjectionistEventBusWrapper;
use Patchlevel\EventSourcing\Projection\Projector\InMemoryProjectorRepository;
use Patchlevel\EventSourcing\Projection\Projector\MetadataProjectorResolver;
use Patchlevel\EventSourcing\Projection\Projector\Projector;
use Patchlevel\EventSourcing\Projection\Projector\ProjectorRepository;
use Patchlevel\EventSourcing\Projection\Projector\ProjectorResolver;
use Patchlevel\EventSourcing\Repository\DefaultRepositoryManager;
Expand Down Expand Up @@ -93,6 +93,7 @@
use Patchlevel\Hydrator\MetadataHydrator;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Reference;
Expand Down Expand Up @@ -208,8 +209,12 @@ private function configureEventBus(array $config, ContainerBuilder $container):
/** @param Config $config */
private function configureProjection(array $config, ContainerBuilder $container): void
{
$container->registerForAutoconfiguration(Projector::class)
->addTag('event_sourcing.projector');
$container->registerAttributeForAutoconfiguration(
Projector::class,
static function (ChildDefinition $definition): void {
$definition->addTag('event_sourcing.projector');
},
);

$container->register(InMemoryProjectorRepository::class)
->setArguments([
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/CreatedSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Patchlevel\EventSourcingBundle\Tests\Fixtures;

use Patchlevel\EventSourcing\Attribute\Handle;
use Patchlevel\EventSourcing\Attribute\Subscribe;
use Patchlevel\EventSourcing\EventBus\Message;
use Patchlevel\EventSourcing\EventBus\Subscriber;

class CreatedSubscriber extends Subscriber
{
#[Handle(ProfileCreated::class)]
#[Subscribe(ProfileCreated::class)]
public function onProfileCreated(Message $message): void
{
// do nothing
Expand Down
8 changes: 4 additions & 4 deletions tests/Fixtures/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
namespace Patchlevel\EventSourcingBundle\Tests\Fixtures;

use Patchlevel\EventSourcing\Aggregate\BasicAggregateRoot;
use Patchlevel\EventSourcing\Aggregate\CustomId;
use Patchlevel\EventSourcing\Attribute\Aggregate;
use Patchlevel\EventSourcing\Attribute\Apply;
use Patchlevel\EventSourcing\Attribute\Id;

#[Aggregate('profile')]
class Profile extends BasicAggregateRoot
{
public function aggregateRootId(): string
{
return '1';
}
#[Id]
private CustomId $id;

#[Apply]
protected function applyProfileCreated(ProfileCreated $event): void
Expand Down
5 changes: 4 additions & 1 deletion tests/Fixtures/ProfileCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

namespace Patchlevel\EventSourcingBundle\Tests\Fixtures;

use Patchlevel\EventSourcing\Aggregate\CustomId;
use Patchlevel\EventSourcing\Attribute\Event;
use Patchlevel\EventSourcing\Serializer\Normalizer\IdNormalizer;

#[Event('profile.created')]
class ProfileCreated
{
public function __construct(
public string $id
#[IdNormalizer(CustomId::class)]
public CustomId $id
) {

}
Expand Down
Loading

0 comments on commit 7734566

Please sign in to comment.