AggregateChanged
Something that happened in the past and that is of importance to the business.
- Full name:
\Codefy\Domain\EventSourcing\AggregateChanged
- This class implements:
\Codefy\Domain\EventSourcing\DomainEvent
Constants
Constant | Visibility | Type | Value |
---|---|---|---|
DATE_FORMAT | public | 'Y-m-d H:i:s.u' |
Properties
payload
metadata
recordedAt
Methods
__construct
private __construct(\Codefy\Domain\Aggregate\AggregateId $aggregateId, ?array $payload, ?array $metadata = []): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$aggregateId | \Codefy\Domain\Aggregate\AggregateId | |
$payload | ?array | |
$metadata | ?array |
occur
Named constructor for generating a domain event.
final public static occur(\Codefy\Domain\Aggregate\AggregateId $aggregateId, array $payload, array $metadata = []): self
-
This method is static.
-
This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$aggregateId | \Codefy\Domain\Aggregate\AggregateId | |
$payload | array | |
$metadata | array |
fromArray
Named constructor for generating a domain event from an array.
-
This method is static.
-
This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$data | array |
payload
Returns payload array.
eventType
Name of the event.
aggregateId
The ID of the Aggregate this event belongs to.
eventId
Uuid of the event.
metadata
Event metadata.
playhead
Aggregate version.
recordedAt
The date the event occurred on.
toArray
Returns array of event data.
param
Retrieve data from payload by name.
Parameters:
Parameter | Type | Description |
---|---|---|
$name | string | |
$default | mixed |
metaParam
Retrieve meta data from metadata by name.
Parameters:
Parameter | Type | Description |
---|---|---|
$name | string | |
$default | mixed |
withMetadata
Append event metadata.
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$metadata | array |
withAddedMetadata
Append event metadata.
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$value | mixed |
withPlayhead
Append event version.
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$playhead | int |
setEventId
Parameters:
Parameter | Type | Description |
---|---|---|
$eventId | \Codefy\Domain\EventSourcing\EventId |
setEventType
Parameters:
Parameter | Type | Description |
---|---|---|
$eventType | string |
setAggregateId
Parameters:
Parameter | Type | Description |
---|---|---|
$aggregateId | \Codefy\Domain\Aggregate\AggregateId |
setPlayhead
Parameters:
Parameter | Type | Description |
---|---|---|
$playhead | int |
setPayload
Parameters:
Parameter | Type | Description |
---|---|---|
$payload | ?array |
init
Automatically generated on 2025-10-13