/**
  * @param DomainMessage $domainMessage
  */
 private function insertEvent(DomainMessage $domainMessage)
 {
     try {
         $this->db->table($this->eventStoreTableName)->insert(['uuid' => (string) $domainMessage->getId(), 'playhead' => $domainMessage->getPlayHead(), 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), 'recorded_on' => (string) $domainMessage->getRecordedOn(), 'type' => $domainMessage->getType()]);
     } catch (\PDOException $ex) {
         if ($ex->getCode() == 23000) {
             throw new DuplicateAggregatePlayhead((string) $domainMessage->getId(), $domainMessage->getPlayHead());
         }
         throw $ex;
     }
 }
 /**
  * @param DomainMessage $domainMessage
  */
 private function insertEvent(DomainMessage $domainMessage)
 {
     $this->db->table($this->eventStoreTableName)->insert(['uuid' => (string) $domainMessage->getId(), 'playhead' => $domainMessage->getPlayHead(), 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), 'recorded_on' => (string) $domainMessage->getRecordedOn(), 'type' => $domainMessage->getType()]);
 }
 /**
  * @param DomainMessage $domainMessage
  * @return void
  */
 public function handle(DomainMessage $domainMessage)
 {
     $this->queue->push(QueueToEventDispatcher::class, ['uuid' => (string) $domainMessage->getId(), 'playhead' => $domainMessage->getPlayHead(), 'metadata' => json_encode($this->serializer->serialize($domainMessage->getMetadata())), 'payload' => json_encode($this->serializer->serialize($domainMessage->getPayload())), 'recorded_on' => (string) $domainMessage->getRecordedOn(), 'type' => $domainMessage->getType()]);
 }