[TYPO3-mvc] Blog Example and Value Object question

Jochen Rau jochen.rau at typoplanet.de
Mon Dec 28 15:18:13 CET 2009


Hi Franz.

schrieb Franz Koch:
>> I currently have the same issue on deciding whether I make my tags
>> entities or value objects. I'm asking this myself, because what if the
>> tags shall be displayed as tag-cloud, what if (to stay with the blog
>> example) the blog posts shall be displayed by a certain tag? Don't the
>> tags itself need to have an identity to resolve the relations to the
>> blog posts then? I only wonder how a "findPostsByTag" method for the
>> postsRepository would work then.
>
> any suggestions/hints for this? Thanks.

Ok. Back to work now ;-)

> what if (to stay with the blog example) the blog posts shall be displayed by a certain tag?

I would implement a method "findPostsByTag()" in the Blog. It's okay to 
have find-methods inside a aggragate root domain objects as these act 
like a repository for their contained objects. You can iterate over the 
Posts and ask them "isTaggedWith()".

> Don't the tags itself need to have an identity to resolve the relations to the blog posts then?

No. They don't need an identity in terms of DDD. Of course they have an 
internal identity (the uid). In Extbase these are the same, which is a 
little bit confusing.

Regards
Jochen



-- 
Every nit picked is a bug fixed



More information about the TYPO3-project-typo3v4mvc mailing list