I'm reading a book by Eric Evans DDD. And I found a contradiction.
Chapter books about aggregates:
Choose one ENTITY to be the root of each AGGREGATE, and control all access to the objects inside the boundary through the root.
Chapter books about repositories:
A subset of persistent objects must be globally accessible through a search based on object attributes. Such access is needed for the roots of AGGREGATES that are not convenient to reach by traversal. They are usually ENTITIES, sometimes VALUE OBJECTS with complex internal structure, and sometimes enumerated VALUES. Providing access to other objects muddies important distinctions.
Provide REPOSITORIES only for AGGREGATE roots that actually need direct access.
It can be concluded that the root of the aggregate can be:
- entity
- value object
- enumerated values
Correctly I understood everything?
Or may be right:
Provide REPOSITORIES only for
- aggregate roots
- value objects
- enumerated values ?
And what is enumerated values(which needs its own repository!)?