[TYPO3-mvc] repository->add => persistenceManager->persistAll => repository->findBy

Franz Koch typo3.RemoveForMessage at elements-net.de
Mon Jul 12 15:00:00 CEST 2010


Hi happy Daniel,

>>> $sessionId = $this->cartModel->getUserSessionId();
>>> $this->cartModel->setSessionId($sessionId);
>>
>> OT: I think it's not nice to have the cartModel determine the
>> userSessionId and then set it for the same model. From my
>> understandings of your domain, fetching the userSession is in my eyes
>> out of the domain of the cartModel - I'd rather move that to a service.
>
> What do you call a service in the context of extbase? Helper class or what?
> A small question rises in my head here: the model in extbase should only
> get and set Data and do nothing else?

yes, a service is like a helper class in this particular case - not a 
service in the meaning of TYPO3-Service.

As Sebastian pointed out - the model can and should have domain logic of 
course, but fetching the userSessionId does in my eyes not belong to the 
domain that model - but you're the expert of your domain - so only you 
can tell if it's correct or not. As outsider it at least feels strange 
for me, when you fetch and reassign the sessionId from and to the same 
model. And fetching the sessionId also sounds like something that might 
also be needed elsewhere, thus could be "outsourced" to a "feUser" 
object probably or a service/helper.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list