/** * */ protected function replayEvents() { $allEvents = $this->getAllEvents(); $this->output->progressStart(count($allEvents)); foreach ($allEvents as $eventRow) { $object = ['class' => str_replace('.', '\\', $eventRow->type), 'payload' => json_decode($eventRow->payload, true)['payload']]; try { $this->dispatcher->dispatch($eventRow->type, $this->serializer->deserialize($object)); } catch (SerializedClassDoesNotExist $e) { if ($this->logger) { $this->logger->debug("Event class does not exist: [{$object['class']}]"); } continue; } } $this->output->progressFinish(); }
/** * @param \stdClass * @return DomainMessage */ private function deserializeEvent($row) { return new \SmoothPhp\Domain\DomainMessage($row->uuid, $row->playhead, $this->serializer->deserialize(json_decode($row->metadata, true)), $this->serializer->deserialize(json_decode($row->payload, true)), new DateTime($row->recorded_on)); }