Recommend this page to a friend! |
Classes of DeGraciaMathieu | Aggregate Entity Value Object | README.md | Download |
|
Downloadaggregate-entity-valueobjectSmall exercise to differentiate the concepts of aggregate, entity, and value object in PHP. ArchitectureAggregateAn aggregate represents a business concept (ex: budget). It is responsible for containing and ensuring the reliability of the entities it contains (ex: a budget contains transactions). It can also provide entry points to manipulate and interact with its entities (ex: retrieve the amount of transactions). EntityAn entity represents a business concept, similar to aggregates, but on a smaller and individual scale. The values of an entity are always value objects (ex: Name, Amount ...) to protect against primitive obsession. An entity has methods to manipulate its properties, these intermediary methods are essential to avoid exposing the internal structure of the object and to respect the Law of Demeter. Value objectA value object is a reusable class that encapsulates non-business logic. Its responsibility is to represent a meaningful characteristic and ensure the correctness and relevance of its value. Usage
![](https://github.com/DeGraciaMathieu/aggregate-entity-valueobject/assets/11473997/d9353c77-6363-4788-a358-fcf80bbe35d9) |