[TYPO3-mvc] Blog Example and Value Object question
Franz Koch
typo3.RemoveForMessage at elements-net.de
Wed Dec 30 23:39:49 CET 2009
Hi Masi,
> Franz Koch schrieb:
>> 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.
nice how I disagree in my own answers. In one second I thing I got it,
in the other second I read some posting in the NG and everything is just
upside down and confusing again. Maybe we both try to find "the" proper
way for doing things, but like in life there are several ways to get to
the same place. But some "best practice HowTo" would still be nice to
have :)
> 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.
From what I see and understand, your code should work:
$query = $this->queryFactory->create('Tx_BlogExample_Domain_Model_Post');
This seems to be correct in my eyes to get a valid query object for the
posts. But I can't tell if somewhere in the extbase magic the
queryObject is relying on the repositoryObject. So I'd better be quiet
and listen on Jochens suggestions now - because I'm myself, just like
you, a beginner in this stuff.
>> 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? ;)
Although I'm no expert, I'd say so. Using a empty or negative limit
would probably also do the trick and might not be wrong from a technical
side, but is not that self explaining like the other methods. And AFAIK
DDD is about to make stuff that easy to understand and work with that
even customers understand what to do - right?
--
kind regards,
Franz Koch
---------------------------------------------------
PayPal-Account: 'paypal _at_ elements-net _dot_ de'
---------------------------------------------------
More information about the TYPO3-project-typo3v4mvc
mailing list