aggregateType() 공개 메소드

public aggregateType ( ) : AggregateType
리턴 Prooph\EventStore\Aggregate\AggregateType
 /**
  * Save a snapshot
  *
  * @param Snapshot $snapshot
  * @return void
  */
 public function save(Snapshot $snapshot)
 {
     $table = $this->getTable($snapshot->aggregateType());
     $this->connection->insert($table, ['aggregate_type' => $snapshot->aggregateType()->toString(), 'aggregate_id' => $snapshot->aggregateId(), 'last_version' => $snapshot->lastVersion(), 'created_at' => $snapshot->createdAt()->format('Y-m-d\\TH:i:s.u'), 'aggregate_root' => serialize($snapshot->aggregateRoot())], ['string', 'string', 'integer', 'string', 'blob']);
     $queryBuilder = $this->connection->createQueryBuilder();
     $table = $this->getTable($snapshot->aggregateType());
     $queryBuilder->delete($table)->where('aggregate_type = :aggregate_type')->andWhere('aggregate_id = :aggregate_id')->andWhere('last_version < :last_version')->setParameter('aggregate_type', $snapshot->aggregateType()->toString())->setParameter('aggregate_id', $snapshot->aggregateId())->setParameter('last_version', $snapshot->lastVersion());
     $queryBuilder->execute();
 }
예제 #2
0
 /**
  * Save a snapshot
  *
  * @param Snapshot $snapshot
  * @return void
  */
 public function save(Snapshot $snapshot)
 {
     $this->map[$snapshot->aggregateType()->toString()][$snapshot->aggregateId()] = $snapshot;
 }
 /**
  * Save a snapshot
  *
  * @param Snapshot $snapshot
  * @return void
  */
 public function save(Snapshot $snapshot)
 {
     $key = $this->getShortAggregateTypeName($snapshot->aggregateType()) . '_' . $snapshot->aggregateId();
     $data = ['aggregate_root' => serialize($snapshot->aggregateRoot()), 'aggregate_type' => $snapshot->aggregateType()->toString(), 'aggregate_id' => $snapshot->aggregateId(), 'last_version' => $snapshot->lastVersion(), 'created_at' => $snapshot->createdAt()->format('U.u')];
     $this->memcached->set($key, $data);
 }
 /**
  * Add a snapshot
  *
  * @param Snapshot $snapshot
  * @return void
  */
 public function add(Snapshot $snapshot)
 {
     $table = $this->getTable($snapshot->aggregateType());
     $this->connection->insert($table, ['aggregate_type' => $snapshot->aggregateType()->toString(), 'aggregate_id' => $snapshot->aggregateId(), 'last_version' => $snapshot->lastVersion(), 'created_at' => $snapshot->createdAt()->format('Y-m-d\\TH:i:s.u'), 'aggregate_root' => serialize($snapshot->aggregateRoot())], ['string', 'string', 'integer', 'string', 'blob']);
 }
 /**
  * Save a snapshot
  *
  * @param Snapshot $snapshot
  * @return void
  */
 public function save(Snapshot $snapshot)
 {
     $gridFs = $this->getGridFs($snapshot->aggregateType());
     $createdAt = new \MongoDate($snapshot->createdAt()->getTimestamp(), $snapshot->createdAt()->format('u'));
     $gridFs->storeBytes(serialize($snapshot->aggregateRoot()), ['aggregate_type' => $snapshot->aggregateType()->toString(), 'aggregate_id' => $snapshot->aggregateId(), 'last_version' => $snapshot->lastVersion(), 'created_at' => $createdAt], $this->writeConcern);
     $gridFs->remove(['aggregate_type' => $snapshot->aggregateType()->toString(), 'aggregate_id' => $snapshot->aggregateId(), 'last_version' => ['$lt' => $snapshot->lastVersion()]], $this->writeConcern);
     $gridFs->remove(['aggregate_type' => $snapshot->aggregateType()->toString(), 'aggregate_id' => $snapshot->aggregateId(), 'last_version' => $snapshot->lastVersion(), 'created_at' => ['$lt' => $createdAt]], $this->writeConcern);
 }