Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Attach upcaster to Prooph Event Store
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' }
<?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__);
}
}
@webdevilopers

This comment has been minimized.

Copy link
Owner Author

@webdevilopers webdevilopers commented Jan 8, 2021

For further discussion please visit the #PHPDDD repository:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment