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

Update fromStream for Projection, Query and ReadModelProjection #350

Merged
merged 1 commit into from
Nov 3, 2018
Merged

Update fromStream for Projection, Query and ReadModelProjection #350

merged 1 commit into from
Nov 3, 2018

Conversation

fjogeleit
Copy link
Contributor

This change make it possible to query for a single aggregate with a SingleStream- and SimpleStreamStrategy behind.

@coveralls
Copy link

coveralls commented Nov 1, 2018

Coverage Status

Coverage increased (+0.002%) to 99.009% when pulling 68a823c on fjogeleit:master into c71cc42 on prooph:master.

Copy link

@gquemener gquemener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One use case I see for that is when projection only relies on a subset of the events (by type for instance).

Is that what you had in mind as well?
I'm wondering if there is a reason why this wasn't in the interface already?

src/Projection/InMemoryEventStoreQuery.php Outdated Show resolved Hide resolved
@@ -29,6 +30,8 @@ public function fromStream(string $streamName): Query;

public function fromStreams(string ...$streamNames): Query;

public function fromStreamWithMetadataMatcher(string $streamName, MetadataMatcher $metadataMatcher): Query;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a BC break and should be released in a new major version, shouldn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, my bad. I think this should work:
public function fromStream(string $streamName, MetadataMatcher $metadataMatcher = null): Query;

@fjogeleit
Copy link
Contributor Author

My main reason for this is to have the possibility to filter the stream by the aggregateID to calculate additional data bei a given time range. But its also possible to filter by type, version and so on. You can also add custom meta data to your events and filter by it.

Copy link
Member

@prolic prolic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally I'd like to have this functionality in Projection and ReadModelProjection as well.

src/Projection/InMemoryEventStoreQuery.php Outdated Show resolved Hide resolved
@@ -29,6 +30,8 @@ public function fromStream(string $streamName): Query;

public function fromStreams(string ...$streamNames): Query;

public function fromStreamWithMetadataMatcher(string $streamName, MetadataMatcher $metadataMatcher): Query;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, my bad. I think this should work:
public function fromStream(string $streamName, MetadataMatcher $metadataMatcher = null): Query;

@fjogeleit fjogeleit changed the title Implement fromStreamWithMetadataMatcher for Projection Query Update fromStream for Projection, Query and ReadModelProjection Nov 2, 2018
@prolic
Copy link
Member

prolic commented Nov 2, 2018

Looks good so far. Before merging this, I'd like to see two things.

  1. implementation for pdo event store
  2. docs

@fjogeleit
Copy link
Contributor Author

A PR for the PDO Event Store is already open: prooph/pdo-event-store#177

Docs will be updated asap

this Method has now a second optional MetaMatcher as parameter. This change make it possible to query for a single aggregate with a SingleStream- and SimpleStreamStrategy behind.
@prolic prolic merged commit 653d59c into prooph:master Nov 3, 2018
@prolic
Copy link
Member

prolic commented Nov 3, 2018 via email

@gquemener
Copy link

gquemener commented Nov 3, 2018 via email

@prolic
Copy link
Member

prolic commented Nov 3, 2018 via email

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

Successfully merging this pull request may close these issues.

4 participants