create() public method

public create ( Stream $stream ) : void
$stream Prooph\EventStore\Stream\Stream
return void
Ejemplo n.º 1
0
 /**
  * @param Stream $stream
  * @throws Exception\RuntimeException
  * @return void
  */
 public function create(Stream $stream)
 {
     $argv = ['stream' => $stream];
     $event = $this->actionEventEmitter->getNewActionEvent(__FUNCTION__ . '.pre', $this, $argv);
     $this->actionEventEmitter->dispatch($event);
     if ($event->propagationIsStopped()) {
         return;
     }
     if ($this->transactionLevel === 0) {
         throw new RuntimeException('Stream creation failed. EventStore is not in an active transaction');
     }
     $stream = $event->getParam('stream');
     $this->adapter->create($stream);
     $this->recordedEvents = array_merge($this->recordedEvents, $stream->streamEvents());
     $event->setName(__FUNCTION__ . '.post');
     $this->actionEventEmitter->dispatch($event);
 }