[TYPO3-mvc] Tx_Extbase_MVC_Controller_Argument StoragePage

Martin Kutschker masi-no at spam-typo3.org
Tue Jun 22 20:43:30 CEST 2010


Franz Koch schrieb:
> Hey,
> 
>>> if only aggregate roots should/can have a repository in DDD, how is one
>>> supposed to fetch objects/data for special needs the right way?
>>
>> What special needs? If the data you request belongs to a model then
>> you get it from it. If you think
>> about statistical data etc then the repository itself will give you
>> the data (when you create the
>> special methods on it).
> 
> Yes, with special needs I also meant something like statistics, but also
> special occasions, where it's just way faster to fetch
> non-aggregate-roots (e.g. for building up select boxes for filtering
> stuff) via their own repositories with a special query instead of
> fetching and iterating over ALL your aggregate roots and collect the
> needed information (which can be quite a lot and kills performance).
> Or is it in those cases better to ask the aggregate root repository to
> deliver those other objects?

Maybe I'm telling you nothing new, but let's recap how Evans defines an aggregate:

"A cluster of associated objects that are treated as a unit for the purpose of data changes.
External references are restricted to one member (class) of the aggregate, designated  as the root."

OTOH, a repository is a storage that "emulates a collection of objects".

So the point is not that you may not get access to non-root members of an aggregate (eg to perform a
calculation). The point is that you may only hold a transient reference to it and you must ask the
aggregate's root entity for it (via object traversals).

Therefore all objects of an aggregate are in the same repository. Simply add functions to it that
returns collections of objects or arrays suitable for building the necessary select boxes.

> Someone has to enlighten me on that during T3DD (and testdriven design)

Reading Domain Driven Design by Evans really helps.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list