/** * Insert an event * * @param StreamName $streamName * @param DomainEvent $e * @return void */ protected function insertEvent(StreamName $streamName, DomainEvent $e) { $eventData = array('event_id' => $e->uuid()->toString(), 'version' => $e->version(), 'event_name' => $e->messageName(), 'event_class' => get_class($e), 'payload' => Serializer::serialize($e->payload(), $this->serializerAdapter), 'created_at' => $e->createdAt()->format(\DateTime::ISO8601)); foreach ($e->metadata() as $key => $value) { $eventData[$key] = (string) $value; } $tableGateway = $this->getTablegateway($streamName); $tableGateway->insert($eventData); }
/** * @test */ function it_has_a_name() { $this->assertEquals('TestDomainEvent', $this->domainEvent->messageName()); }