Ejemplo n.º 1
0
 /**
  * Save aggregate root
  *
  * @param Snapshot $snapshot
  * @return void
  */
 public function save(Snapshot $snapshot)
 {
     $this->adapter->save($snapshot);
 }
Ejemplo n.º 2
0
 /**
  * @param TakeSnapshot $command
  */
 public function __invoke(TakeSnapshot $command)
 {
     $repository = $this->aggregateRepositories[$command->aggregateType()];
     $aggregateRoot = $repository->getAggregateRoot($command->aggregateId());
     $this->snapshotAdapter->add(new Snapshot(AggregateType::fromAggregateRootClass($command->aggregateType()), $command->aggregateId(), $aggregateRoot, $command->version(), $command->createdAt()));
 }