[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:43:30 CET 2011
Hey Peter,
> It would be awesome if you could some up the findings from this thread
> and we get some guidance/tips from "the makers of". ;)
well, I'm not one of the makers - I'm just a contributor and have no
clue why they used clones in the blog example. All statements I took in
this topic are just my findings when thinking about using clones in
domain models. I haven't read any book or anything else about it - it's
just what seemed most logical to me.
> For now I will avoid clone() and see how far I get. :->
As I said - I myself didn't use clones in models yet and they might not
be needed for 90% or more of all extension - but I can imagine cases
where the domain logic requires to pass clones instead of the originals,
just to prevent the manipulation of the original objects (ok - you could
also just not provide setters, but that might not always be possible).
> P.S.: To me it is even still unclear when and where those getters() and
> setters() are called/used within the extbase framework, if at all. fluid
> afaik uses the getters, but there it probably shouldn't make a
> difference wether we have a clone() or not?
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.
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list