Prooph\EventStore\Aggregate\AggregateTranslator::extractPendingStreamEvents PHP Method

extractPendingStreamEvents() public method

public extractPendingStreamEvents ( object $eventSourcedAggregateRoot ) : Prooph\Common\Messaging\Message[]
$eventSourcedAggregateRoot object
return Prooph\Common\Messaging\Message[]
    public function extractPendingStreamEvents($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::extractPendingStreamEvents