Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Serialize and deserialize events with value objects #126

Closed
enricobono opened this issue Mar 11, 2019 · 1 comment
Closed

Serialize and deserialize events with value objects #126

enricobono opened this issue Mar 11, 2019 · 1 comment

Comments

@enricobono
Copy link

Hi.
I have this event:

class ReactionAdded implements ShouldBeStored
{
    private $Id;
    private $reactionType;

    public function __construct(
        int $id,
        ReactionType $reactionType
    ) {
    }
}

Well, I cannot projects the event, I get this error:

Failed to unserialize an event with class `App\Events\ReactionAdded` on stored event with id `11`. Are you sure that event class exists?

The stack trace shows InvalidStoredEvent::couldNotUnserializeEvent, and it seems it cannot deserialize the event, given I'm using the ´ReactionType` Value Object.
What is the correct syntax to use an event with a value object in the constructor?

@freekmurze
Copy link
Member

If the default serializer does not work for you, consider creating your own custom one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants