Recommend this page to a friend! |
Classes of Unay Santisteban | PHP Domain Driven Design Model | wiki/Domain-Modeling-Entities.md | Download |
|
DownloadEntities> Objects that have a distinct identity that runs through time and different representations.\ > -- Eric Evans An Entity is a fundamental concept representing a distinct, identifiable object with a continuous and evolving lifecycle. Unlike Value Objects, which are defined by their attributes and are interchangeable based on their values, Entities are distinguished by a unique identity that persists over time. Getting StartedCreating an Entity with the Complex Heart Domain Model is really simple. The library provides a trait
named
Additionally, you can implement the ExampleLet's illustrate the implementation of a
Key ConceptsIdentityEntities have a distinct identity that sets them apart from other objects. This identity often persists across different states or versions of the object. LifecycleEntities have a lifecycle that spans various states or transitions. They exist beyond a single operation or transaction, maintaining continuity and relevance over time. MutabilityUnlike Value Objects, Entities can undergo changes in their internal state while retaining the same identity. This mutability is often a crucial aspect of their behavior. Equality Based on IdentityEquality for Entities is based on identity rather than the equality of attribute values. Two entities with the same
identity are considered equal, regardless of potential differences in other attributes. You can use the
Consistency and Business RulesEntities encapsulate and enforce business rules and logic related to their specific domain. They are responsible for maintaining consistency within their boundaries. You can use invariants the same way that with the Value Objects.
|