extractAggregateId() public method

public extractAggregateId ( object $eventSourcedAggregateRoot ) : string
$eventSourcedAggregateRoot object
return string
 /**
  * @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;
 }
 /**
  * @param object $eventSourcedAggregateRoot
  * @throws Exception\AggregateTypeException
  */
 public function addAggregateRoot($eventSourcedAggregateRoot)
 {
     $this->aggregateType->assert($eventSourcedAggregateRoot);
     $domainEvents = $this->aggregateTranslator->extractPendingStreamEvents($eventSourcedAggregateRoot);
     $aggregateId = $this->aggregateTranslator->extractAggregateId($eventSourcedAggregateRoot);
     $streamName = $this->determineStreamName($aggregateId);
     $enrichedEvents = [];
     foreach ($domainEvents as $event) {
         $enrichedEvents[] = $this->enrichEventMetadata($event, $aggregateId);
     }
     if ($this->oneStreamPerAggregate) {
         $stream = new Stream($streamName, new ArrayIterator($enrichedEvents));
         $this->eventStore->create($stream);
     } else {
         $this->eventStore->appendTo($streamName, new ArrayIterator($enrichedEvents));
     }
 }