/** * @param Stream $stream * @throws \Prooph\EventStore\Exception\RuntimeException * @return void */ public function create(Stream $stream) { if (count($stream->streamEvents()) === 0) { throw new RuntimeException(sprintf("Cannot create empty stream %s. %s requires at least one event to extract metadata information", $stream->streamName()->toString(), __CLASS__)); } $firstEvent = $stream->streamEvents()[0]; $this->createSchemaFor($stream->streamName(), $firstEvent->metadata()); $this->appendTo($stream->streamName(), $stream->streamEvents()); }
/** * @param Stream $stream */ public function create(Stream $stream) { $this->appendTo($stream->streamName(), $stream->streamEvents()); }
/** * @param Stream $stream * @throws RuntimeException If creation of stream fails * @return void */ public function create(Stream $stream) { if (!$stream->streamEvents()->valid()) { throw new RuntimeException(sprintf("Cannot create empty stream %s. %s requires at least one event to extract metadata information", $stream->streamName()->toString(), __CLASS__)); } $streamName = $stream->streamName(); $this->createIndexes($streamName); $this->appendTo($streamName, $stream->streamEvents()); }
/** * @param Stream $stream * @return void */ public function create(Stream $stream) { $streamEvents = $stream->streamEvents(); $streamEvents->rewind(); $this->streams[$stream->streamName()->toString()] = $streamEvents; }
/** * @param Stream $stream * @return void */ public function create(Stream $stream) { $this->streams[$stream->streamName()->toString()] = $stream->streamEvents(); }