Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshot args incorrect #51

Closed
basz opened this issue Feb 8, 2017 · 6 comments
Closed

Snapshot args incorrect #51

basz opened this issue Feb 8, 2017 · 6 comments
Labels
Milestone

Comments

@basz
Copy link
Member

basz commented Feb 8, 2017

[Symfony\Component\Debug\Exception\FatalThrowableError]                                                                                                                             
  Type error: Argument 1 passed to Prooph\SnapshotStore\Snapshot::__construct() must be of the type string, object given, called in /home-projects/api-plhw-development/deploy/relea  
  ses/20161219092409UTC/vendor/prooph/event-sourcing/src/Aggregate/SnapshotReadModel.php on line 91                                                                                   

https://github.com/prooph/event-sourcing/blob/develop/src/Aggregate/SnapshotReadModel.php#L86-L88

Tell me that should be get_class($aggregateRoot) and I'll PR it

@prolic
Copy link
Member

prolic commented Feb 9, 2017 via email

@prolic prolic added the bug label Feb 9, 2017
@prolic prolic added this to the 5.0 Release milestone Feb 9, 2017
@basz
Copy link
Member Author

basz commented Feb 9, 2017

? there is no toString method on the AR... Should I implement that? No... Looking at the signature of Snapshot::__construct the first argument should the the aggregateType.

_construct(
        string $aggregateType,
        string $aggregateId,
        $aggregateRoot,
        int $lastVersion,
        DateTimeImmutable $createdAt
    )

Then get_class() should do it?

prolic added a commit that referenced this issue Feb 9, 2017
@prolic prolic mentioned this issue Feb 9, 2017
@basz
Copy link
Member Author

basz commented Feb 10, 2017

I now see the following is used elsewhere to get the AR type (vendor/prooph/snapshotter/src/StreamSnapshotProjection.php) and would prevent adding the toString method to the aggregate. I think that would be better, no?

(string) AggregateType::fromAggregateRoot($aggregateRoot),

@prolic
Copy link
Member

prolic commented Feb 10, 2017

nice hint: @codeliner what do you think?

@codeliner
Copy link
Member

looks good 👍

@basz
Copy link
Member Author

basz commented Feb 10, 2017

ok, ill do a pr

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

No branches or pull requests

3 participants