[TYPO3-mvc] Cloning properties in setter and getter methods of models (blog example)

Franz Koch typo3.RemoveForMessage at elements-net.de
Sun Feb 13 14:54:20 CET 2011


Hey,

> well, for simple extensions just passing domain objects to FLUID it
> really doesn't matter if somethings a clone or not. And it probably
> might not even be necessary for the blog_example - didn't have a too
> close look at it though.

just had a look at the blogExample again - and even there it's used 
inconsistently. "setComments" is assigning the objectStorage directly 
while "getComments" is returning a clone. Same for relatedPosts. But for 
tags in both cases clones are used. I don't see a strict concept behind. 
As I said, in my eyes it kind of makes sense to return clones of 
objectStorages just to prevent the manipulation of it directly without 
using domain aware methods (add/remove methods of your domain object).

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list