[TYPO3-50-general] FLOW3 and DDD

Robert Lemke robert at typo3.org
Mon Jan 19 10:59:20 CET 2009


Hi Nino,

Am 19.01.2009 um 10:33 schrieb Nino Martincevic:

> well, an Entity is always a member of an aggregate.
> There is no such thing like an entity without aggregate (root)
> Entities are only accessible through an aggregate root.

Yes, sure, but technically you can annotate a class as @entity, create
an instance of it and don't add it to a repository or an entity which
is part of an aggregate. Then it won't be persisted.

So conceptually a class annotated as @entity is always a member of an
aggregate. But it doesn't mean that it will be persisted (that's only
the case if it has a connectino to a repository).

> But there may be aggregates which consist just of one entity, a common
> example is an Address or a Zip(code), if they are entities in your
> domain model (btw. address should almost always be an entity...) or  
> just
> any other non-complex entity.
>
> Another thing are value objects, they don't need to have an  
> aggregate to
> access them. They can be created and destroyed at any time, yes, but  
> do
> they make sense if they are not members of some entity and therefore
> aggregate? Just now I would not have an example for this case.

Value objects are only persisted as part of an entity, so yes, you're  
right,
you can create a value object whenever you like.

> And actually you don't and can't have a repository for value objects,
> because they have no identity. How a repository would find them then?

Sure, but I didn't say that, did I?

Cheers,
robert


More information about the TYPO3-project-5_0-general mailing list