Esempio n. 1
0
 public function addSet(Event\Set $events)
 {
     $class = $this->reflection->resolveClass($events->getEmitter());
     $id = (string) $events->getEmitter()->getId();
     if (isset($this->events[$class][$id])) {
         $this->events[$class][$id] = array_merge($this->events[$class][$id], $events->all());
         return;
     }
     $this->events[$class][$id] = $events->all();
 }
Esempio n. 2
0
 public function addSet(Event\Set $events)
 {
     $class = $this->reflection->resolveClass($events->getEmitter());
     $this->events->selectCollection($class)->batchInsert(array_map(function ($event) {
         return ['emitter_id' => (string) $event->getEmitterId(), 'event_class' => $this->reflection->resolveClass($event), 'event' => $this->serializer->serialize($event)];
     }, $events->all()));
 }
Esempio n. 3
0
 public function addSet(Event\Set $events)
 {
     $emitter = $events->getEmitter();
     $class = (new Reflection($emitter))->resolveClass($emitter);
     $id = (string) $emitter->getId();
     $this->assertSameVersion($emitter, $class, $id);
     $this->store->addSet($events);
     $this->versionTransporter->update($class, $id, $this->store->getCurrentVersion($class, $id));
 }