Skip to content

Commit

Permalink
Fix reference error in PostgresEventStore for MetadataMatcher with IN…
Browse files Browse the repository at this point in the history
… Operations.

The removed value reference leads to wrong values for the IN operation.

Example:

```
(new MetadataMatcher())
	->withMetadataMatch(
	    'event_name',
	    Operator::IN(),
	    [
	        'Event-1',
	        'Event-2'
	    ],
	    FieldType::MESSAGE_PROPERTY()
	)
```

Results to:

```
$values = [
	'metadata_0_0' => 'Event-1',
	'metadata_0_1' => 'Event-1'
]
```

The Second values is replaced by the value reference with the first one.
  • Loading branch information
Frank committed Apr 1, 2019
1 parent 9f6b1cb commit 416351a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PostgresEventStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,9 @@ private function createWhereClause(?MetadataMatcher $metadataMatcher): array
$parameters = [];

if (\is_array($value)) {
foreach ($value as $k => &$v) {
foreach ($value as $k => $v) {
$parameters[] = ':metadata_' . $key . '_' . $k;
$v = (string) $v;
$value[$k] = (string) $v;
}
} else {
$parameters = [':metadata_' . $key];
Expand Down

0 comments on commit 416351a

Please sign in to comment.