Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function add(TracksEvents $aggregate)
 {
     if (!$this->identityMap->contains($aggregate->aggregateId())) {
         $this->identityMap->add($aggregate);
     }
     $this->repository->add($aggregate);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function add(TracksEvents $aggregate)
 {
     $lookupKey = $this->createLookupKey($aggregate->aggregateId());
     if (isset($this->map[$lookupKey])) {
         throw DuplicateAggregateFound::create($aggregate->aggregateId());
     }
     $this->map[$lookupKey] = $aggregate;
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function add(TracksEvents $aggregate)
 {
     if (!$aggregate->hasRecordedEvents()) {
         return;
     }
     $recordedEvents = $aggregate->recordedEvents();
     $aggregate->eraseRecordedEvents();
     $envelopeStream = $this->eventWrapper->wrap($aggregate->aggregateId(), $recordedEvents);
     $this->eventStore->commit($envelopeStream);
 }