public function addEvent($payload, $metadata = null)
    {
        $domainEventMessage = new GenericDomainEventMessage(
            $this->aggregateType,
            $this->aggregateId,
            $this->newSequenceNumber(),
            $payload,
            $metadata
        );

        $this->addEventMessage($domainEventMessage);
        return $domainEventMessage;
    }
public function addEvent($payload, $metadata = null)
    {
        $domainEventMessage = new GenericDomainEventMessage(
            $this->aggregateType,
            $this->aggregateId,
            $this->newSequenceNumber(),
            $payload,
            $metadata
        );

        $this->addEventMessage($domainEventMessage);
        return $domainEventMessage;
    }
public function addEvent ( $ payload , $ metadata = null ) { $ domainEventMessage = new GenericDomainEventMessage ( $ this -> aggregateType , $ this -> aggregateId , $ this -> newSequenceNumber ( ) , $ payload , $ metadata ) ; $ this -> addEventMessage ( $ domainEventMessage ) ; return $ domainEventMessage ; }
Add an event to this container.

@param mixed $payload
@param Metadata|array $metadata
@return GenericDomainEventMessage
Add an event to this container .