Skip to content

EventSourcedAggregate

Properties

aggregateId

public \Codefy\Domain\Aggregate\AggregateId $aggregateId

Methods

__construct

private __construct(\Codefy\Domain\Aggregate\AggregateId $aggregateId): mixed

Parameters:

Parameter Type Description
$aggregateId \Codefy\Domain\Aggregate\AggregateId

root

final public static root(\Codefy\Domain\Aggregate\AggregateId $aggregateId): static
  • This method is static.

  • This method is final.

Parameters:

Parameter Type Description
$aggregateId \Codefy\Domain\Aggregate\AggregateId

recordApplyAndPublishThat

Records, applies, and publishes a domain event.

protected recordApplyAndPublishThat(\Codefy\Domain\EventSourcing\DomainEvent $event): void

Parameters:

Parameter Type Description
$event \Codefy\Domain\EventSourcing\DomainEvent

applyThat

protected applyThat(\Codefy\Domain\EventSourcing\DomainEvent $event): void

Parameters:

Parameter Type Description
$event \Codefy\Domain\EventSourcing\DomainEvent

hasRecordedEvents

Determine whether the object's state has changed since the last clearRecordedEvent();

public hasRecordedEvents(): bool

getRecordedEvents

Get all the Domain Events that were recorded since the last time it was cleared, or since it was restored from persistence. This does not include events that were recorded prior.

public getRecordedEvents(): \Codefy\Domain\EventSourcing\DomainEvents

Throws:


clearRecordedEvents

Clears the record of new Domain Events. This doesn't clear the history of the object.

public clearRecordedEvents(): void

aggregateId

Returns unique aggregate id.

public aggregateId(): \Codefy\Domain\Aggregate\AggregateId

playhead

Aggregate root version.

public playhead(): int

reconstituteFromEventStream

Reconstitutes an Aggregate instance from its history of domain events.

public static reconstituteFromEventStream(\Codefy\Domain\EventSourcing\EventStream $aggregateHistory): \Codefy\Domain\Aggregate\RecordsEvents
  • This method is static.

Parameters:

Parameter Type Description
$aggregateHistory \Codefy\Domain\EventSourcing\EventStream

equals

final public equals(\Codefy\Domain\Aggregate\AggregateRoot $aggregateRoot): bool
  • This method is final.

Parameters:

Parameter Type Description
$aggregateRoot \Codefy\Domain\Aggregate\AggregateRoot

className

Retrieves the class name.

final public static className(): string
  • This method is static.

  • This method is final.


Inherited methods

publishThat

protected publishThat(\Codefy\Domain\EventSourcing\DomainEvent $event): void

Parameters:

Parameter Type Description
$event \Codefy\Domain\EventSourcing\DomainEvent

aggregateId

public aggregateId(): \Codefy\Domain\Aggregate\AggregateId
  • This method is abstract.

recordThat

Records domain events.

protected recordThat(\Codefy\Domain\EventSourcing\DomainEvent $event): void

Parameters:

Parameter Type Description
$event \Codefy\Domain\EventSourcing\DomainEvent

pullDomainEvents

public pullDomainEvents(): array

when

protected when(\Codefy\Domain\EventSourcing\DomainEvent $event): void
  • This method is abstract.

Parameters:

Parameter Type Description
$event \Codefy\Domain\EventSourcing\DomainEvent


Automatically generated on 2025-10-13