/**
  * {@inheritdoc}
  */
 public function commit()
 {
     if (null !== $this->snapshot) {
         $this->snapshot->commit();
     }
     $this->parentCommit();
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function find(IdentifierInterface $id)
 {
     $class = $this->aggregateRootClass;
     $aggregate = null;
     if (null !== $this->snapshot) {
         $aggregate = $this->snapshot->find($id, $class, $this->table);
     }
     if (null === $aggregate) {
         return $class::{'build'}($this->storage->findEventFromBeginning($this->table, $id));
     }
     if (null !== ($events = $this->storage->findEventFromVersion($this->table, $id, $aggregate->getVersion()))) {
         $aggregate->replay($events);
     }
     return $aggregate;
 }