public function appendSnapshotEvent($type, DomainEventMessageInterface $snapshotEvent)
 {
     $eventFile = $this->fileResolver->openEventFileForReading($type, $snapshotEvent->getAggregateIdentifier());
     $snapshotEventFile = $this->fileResolver->openSnapshotFileForWriting($type, $snapshotEvent->getAggregateIdentifier());
     $snapshotEventWriter = new FilesystemSnapshotEventWriter($eventFile, $snapshotEventFile, $this->serializer);
     $snapshotEventWriter->writeSnapshotEvent($snapshotEvent);
 }
Exemplo n.º 2
0
 protected function handle(DomainEventMessageInterface $event)
 {
     $this->identifier = $event->getAggregateIdentifier();
     $this->invocationCount++;
 }
Exemplo n.º 3
0
 /**
  * Initialize an Event entry for the given <code>event</code>.
  *
  * @param string $type     The type identifier of the aggregate root the event belongs to
  * @param DomainEventMessageInterface $event    The event to store in the EventStore
  * @param SerializedObjectInterface $payload  The serialized payload of the Event
  * @param SerializedObjectInterface $metaData The serialized metaData of the Event
  */
 public function __construct($type, DomainEventMessageInterface $event, SerializedObjectInterface $payload, SerializedObjectInterface $metaData)
 {
     $this->eventIdentifier = $event->getIdentifier();
     $this->type = $type;
     //$this->payloadType = $payload->getContentType();
     $this->payloadType = $payload->getType()->getName();
     $this->payloadRevision = $payload->getType()->getRevision();
     $this->payload = $payload->getData();
     $this->aggregateIdentifier = $event->getAggregateIdentifier();
     $this->scn = $event->getScn();
     $this->metaData = $metaData->getData();
     $this->timestamp = $event->getTimestamp();
 }
 protected function handle(DomainEventMessageInterface $event)
 {
     $this->identifier = $event->getAggregateIdentifier();
     $this->handledEvents[] = $event;
 }
 private function findRedundantSnapshots($type, DomainEventMessageInterface $snapshotEvent, $maxSnapshotsArchived, EntityManager $entityManager)
 {
     $query = $entityManager->createQuery("SELECT e.scn FROM " . $this->snapshotEventEntryEntityName() . " e " . "WHERE e.type = :type AND e.aggregateIdentifier = :aggregateIdentifier " . "ORDER BY e.scn DESC")->setFirstResult($maxSnapshotsArchived - 1)->setMaxResults(1)->setParameters(array(':type' => $type, ':aggregateIdentifier' => $snapshotEvent->getAggregateIdentifier()));
     return $query->getResult();
 }