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