Last active
January 8, 2021 09:05
-
-
Save webdevilopers/38f1f18576251c99b1cd9aad3753c176 to your computer and use it in GitHub Desktop.
Attach upcaster to Prooph Event Store
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
services: | |
Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator: null | |
# Metadata enrichers | |
Acme\Common\Infrastructure\Prooph\EventStore\IPAddressMetadataEnricher: | |
tags: | |
- { name: 'prooph_event_store.default.metadata_enricher' } | |
arguments: | |
- '@request_stack' | |
# Upcasters | |
Acme\Common\Infrastructure\Prooph\EventStore\Upcaster: ~ | |
Prooph\EventStore\Plugin\UpcastingPlugin: | |
arguments: ['@Acme\Common\Infrastructure\Prooph\EventStore\Upcaster'] | |
tags: | |
- { name: 'prooph_event_store.default.plugin' } |
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
<?php | |
namespace Acme\Common\Infrastructure\Prooph\EventStore; | |
use Prooph\Common\Messaging\Message; | |
use Prooph\EventStore\Upcasting\SingleEventUpcaster; | |
final class Upcaster extends SingleEventUpcaster | |
{ | |
public function upcast(Message $message): array | |
{ | |
dd($message); | |
} | |
protected function canUpcast(Message $message): bool | |
{ | |
dd(__METHOD__); | |
} | |
protected function doUpcast(Message $message): array | |
{ | |
dd(__METHOD__); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For further discussion please visit the #PHPDDD repository: