protected function getDomainEventMessage(array $document): DomainEventMessageInterface
    {
        $payload = $this
            ->getSerializer()
            ->unserialize(new SerializedObject(
                $document['payload']['name'],
                $document['payload']['data']
            ));

        /** @var PayloadInterface $payload */
        return new DomainEventMessage(
            $payload,
            new PayloadType($payload),
            $document['occurred_on']->toDateTime(),
            $document['aggregate_id'],
            $document['sequence'],
            $document['meta_data']
        );
    }
protected function getDomainEventMessage(array $document): DomainEventMessageInterface
    {
        $payload = $this
            ->getSerializer()
            ->unserialize(new SerializedObject(
                $document['payload']['name'],
                $document['payload']['data']
            ));

        /** @var PayloadInterface $payload */
        return new DomainEventMessage(
            $payload,
            new PayloadType($payload),
            $document['occurred_on']->toDateTime(),
            $document['aggregate_id'],
            $document['sequence'],
            $document['meta_data']
        );
    }
protected function getDomainEventMessage ( array $ document ) : DomainEventMessageInterface { $ payload = $ this -> getSerializer ( ) -> unserialize ( new SerializedObject ( $ document [ 'payload' ] [ 'name' ] , $ document [ 'payload' ] [ 'data' ] ) ) ; /** @var PayloadInterface $payload */ return new DomainEventMessage ( $ payload , new PayloadType ( $ payload ) , $ document [ 'occurred_on' ] -> toDateTime ( ) , $ document [ 'aggregate_id' ] , $ document [ 'sequence' ] , $ document [ 'meta_data' ] ) ; }
Get domain event message from Mongo document.

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