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

bypass append iterator problems #210

Merged
merged 2 commits into from Nov 7, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+8 −8
Diff settings

Always

Just for now

Next

bypass append iterator problems

  • Loading branch information...
prolic committed Nov 7, 2016
commit 61465535e6acc657c80a1bab7ab909470cf579e8
Copy path View file
@@ -15,7 +15,6 @@
use AppendIterator;
use ArrayIterator;
use Iterator;
use Prooph\Common\Messaging\Message;
use Prooph\EventStore\Exception\StreamNotFoundException;
use Prooph\EventStore\Metadata\MetadataMatcher;
use Prooph\EventStore\Metadata\Operator;
@@ -31,13 +30,13 @@
class InMemoryAdapter implements Adapter
{
/**
* @var Iterator[]
* @var array
*/
protected $streams;
public function hasStream(StreamName $streamName): bool
{
return isset($this->streams[$streamName->toString()]['metadata']);
return isset($this->streams[$streamName->toString()]);
}
public function fetchStreamMetadata(StreamName $streamName): ?array
@@ -54,10 +53,7 @@ public function create(Stream $stream): void
$streamEvents = $stream->streamEvents();
$streamEvents->rewind();
$it = new AppendIterator();
$it->append($streamEvents);
$this->streams[$stream->streamName()->toString()]['events'] = $it;
$this->streams[$stream->streamName()->toString()]['events'] = $streamEvents;
$this->streams[$stream->streamName()->toString()]['metadata'] = $stream->metadata();
}
@@ -70,7 +66,11 @@ public function appendTo(StreamName $streamName, Iterator $domainEvents): void
throw StreamNotFoundException::with($streamName);
}
$this->streams[$streamName->toString()]['events']->append($domainEvents);
$it = new AppendIterator();
$it->append($this->streams[$streamName->toString()]['events']);
$it->append($domainEvents);
$this->streams[$streamName->toString()]['events'] = $it;
}
public function load(
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.