[TYPO3-mvc] Blog Example and Value Object question
Martin Kutschker
masi-no at spam-typo3.org
Wed Dec 30 20:59:26 CET 2009
Franz Koch schrieb:
> Hi,
>
>> How do I access the post repository from the blog repository? Somehow
>> I don't understand why not the
>> blog repository can get the findByTag() method.
>
> I think the method shouldn't be inside the blogRepository but the blog
> model as aggregate root if I understood Jochen correctly.
## Franz wrote:
## Well, you still can create a findPostsByTag method in your
## blogRepository and build a custom query there, right? Isn't that what
## you suggested yourself?
#
# Jochen wrote:
# That’s the way I'd have suggested, too.
But if we want to put the code into the blog model then the question remains how to create a query
for a repository outside of the repository. See my sample code where I manually pass a configuration
string to the create() method. Is it ok to set it that way? You would need to do the same in the
blog model.
Masi
If you like to
> move it to a repository, then the postRepository might be the correct
> one and you would need 4 methods in total for a complete featureset:
>
> findByTag
> findAllByTag
> findByBlogAndTag
> findAllByBlogAndTag
The *all* version are IMHO not really needed. A limit of 0 (or -1) can be used to mean "all" (ie "no
limit"). Or is this another DDD-thingy? ;)
Masi
More information about the TYPO3-project-typo3v4mvc
mailing list