示例#1
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()));
 }
示例#2
0
 public function addSet(Event\Event\Set $events)
 {
     $this->pdo->beginTransaction();
     foreach ($events->all() as $event) {
         $this->add($event);
     }
     $this->pdo->commit();
 }
示例#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));
 }
示例#4
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();
 }
示例#5
0
 public function addSet(Event\Set $events)
 {
     var_dump(sprintf('storing %d events', count($events->all())));
     return $this->store->addSet($events);
 }