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