Recommend this page to a friend! |
Classes of Unay Santisteban | PHP Domain Driven Design Model | wiki/Domain-Modeling-Aggregates.md | Download |
|
DownloadAggregates> Aggregate is a cluster of domain objects that can be treated as a single unit.\ > -- Martin Fowler Creating a Value Object is quite easy you only need to use the Trait ExampleThe following example illustrates the implementation of these components.
Key ConceptsRoot EntityAn Aggregate is always rooted in an Entity known as the "root" of the Aggregate. The root is responsible for maintaining the integrity and consistency of the entire Aggregate. Direct Access Only to RootExternal entities should access an Aggregate only through its root entity. This restriction ensures that the integrity and business rules of the Aggregate are maintained. Consistency BoundaryAggregates define a consistency boundary within which all changes must be consistent. This means that changes to the internal state of the Aggregate (its entities and value objects) are performed through the root entity, ensuring that business rules are enforced consistently. Atomic TransactionsOperations on Aggregates are typically treated as atomic transactions. Changes to the state of the Aggregate are either fully applied or fully rejected, ensuring that the Aggregate is always in a valid and consistent state. Global IdentityEach Aggregate has a global identity represented by the identity of its root entity. This identity is used to uniquely identify and reference the entire Aggregate. EncapsulationAggregates encapsulate internal details, hiding the complexity of their internal structure from external entities. This encapsulation allows for changes to the internal implementation without affecting external entities. Domain EventsDomain Events are events that capture a meaningful state change within the domain. When integrated with Aggregates,
Domain Events enhance the capability to communicate and react to changes effectively. the
The method |