protected function getMongoDocument(DomainEventMessageInterface $domainEventMessage): array
    {
        $payload = $this
            ->getSerializer()
            ->serialize($domainEventMessage->getPayload());

        return [
            'aggregate_id' => $domainEventMessage->getAggregateId(),
            'sequence' => $domainEventMessage->getSequence(),
            'occurred_on' => new UTCDateTime(
                $domainEventMessage
                    ->getOccurredOn()
                    ->format('Uv')
            ),
            'payload' => [
                'name' => $payload->getClassName(),
                'data' => (object)$payload->getData(),
            ],
            'meta_data' => (object)$domainEventMessage->getMetaData(),
        ];
    }
protected function getMongoDocument(DomainEventMessageInterface $domainEventMessage): array
    {
        $payload = $this
            ->getSerializer()
            ->serialize($domainEventMessage->getPayload());

        return [
            'aggregate_id' => $domainEventMessage->getAggregateId(),
            'sequence' => $domainEventMessage->getSequence(),
            'occurred_on' => new UTCDateTime(
                $domainEventMessage
                    ->getOccurredOn()
                    ->format('Uv')
            ),
            'payload' => [
                'name' => $payload->getClassName(),
                'data' => (object)$payload->getData(),
            ],
            'meta_data' => (object)$domainEventMessage->getMetaData(),
        ];
    }
protected function getMongoDocument ( DomainEventMessageInterface $ domainEventMessage ) : array { $ payload = $ this -> getSerializer ( ) -> serialize ( $ domainEventMessage -> getPayload ( ) ) ; return [ 'aggregate_id' => $ domainEventMessage -> getAggregateId ( ) , 'sequence' => $ domainEventMessage -> getSequence ( ) , 'occurred_on' => new UTCDateTime ( $ domainEventMessage -> getOccurredOn ( ) -> format ( 'Uv' ) ) , 'payload' => [ 'name' => $ payload -> getClassName ( ) , 'data' => ( object ) $ payload -> getData ( ) , ] , 'meta_data' => ( object ) $ domainEventMessage -> getMetaData ( ) , ] ; }
Get Mongo document from domain event message.

@param DomainEventMessageInterface $domainEventMessage
@return array
@throws SerializerException
Get Mongo document from domain event message .