Prooph\EventStore\Aggregate\AggregateTranslator::extractAggregateId PHP Méthode

extractAggregateId() public méthode

public extractAggregateId ( object $eventSourcedAggregateRoot ) : string
$eventSourcedAggregateRoot object
Résultat string
    public function extractAggregateId($eventSourcedAggregateRoot);

Usage Example

 /**
  * @param object $eventSourcedAggregateRoot
  * @throws Exception\AggregateTypeException
  */
 public function addAggregateRoot($eventSourcedAggregateRoot)
 {
     if (!is_object($eventSourcedAggregateRoot)) {
         throw new AggregateTypeException(sprintf('Invalid aggregate given. Aggregates need to be of type object but type of %s given', gettype($eventSourcedAggregateRoot)));
     }
     $aggregateId = $this->aggregateTranslator->extractAggregateId($eventSourcedAggregateRoot);
     $domainEvents = $this->aggregateTranslator->extractPendingStreamEvents($eventSourcedAggregateRoot);
     $this->streamStrategy->addEventsForNewAggregateRoot($this->aggregateType, $aggregateId, $domainEvents, $eventSourcedAggregateRoot);
     $this->identityMap[$aggregateId] = $eventSourcedAggregateRoot;
 }
All Usage Examples Of Prooph\EventStore\Aggregate\AggregateTranslator::extractAggregateId