Skip to content

UnitOfWork

A unit of work that acts both as an identity map and a change tracker.

It does not commit/save/persist. Its role is reduced to tracking multiple aggregates, and to hand you back those that have changed. Persisting the ones that have changed or happened on the outside.

Methods

getChanges

Returns AggregateRoots that have changed.

public getChanges(): \Codefy\Domain\Aggregate\RecordsEvents[]

Inherited methods

attachToIdentityMap

Attach an aggregate to the map.

public attachToIdentityMap(\Codefy\Domain\Aggregate\RecordsEvents $aggregate): void

Parameters:

Parameter Type Description
$aggregate \Codefy\Domain\Aggregate\RecordsEvents

retrieveFromIdentityMap

Retrieve an aggregate from the map by its aggregate id.

public retrieveFromIdentityMap(\Codefy\Domain\Aggregate\AggregateId $aggregateId): \Codefy\Domain\Aggregate\RecordsEvents|null

Parameters:

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


Automatically generated on 2025-10-13