[TYPO3-mvc] Cloning properties in setter and getter methods of models (blog example)
Peter Niederlag
typo3-list at niekom.de
Sun Feb 13 11:44:07 CET 2011
Hello,
Am 12.02.2011 04:13, schrieb Franz Koch:
> On 12.02.2011 01:26, Thomas "Thasmo" Deinhamer wrote:
[...]
>> What's your opinion on that?
[...]
> It's a different thing for objectStorages in my eyes. If there's a
> getter for the whole objectStorage, then this one could return a clone
> if adding or removing objects need to be tracked. If not, there's no
> need to clone anything. And as one is supposed to use available
> addSomeObject/removeSomeObject methods of models anyway, this shouldn't
> be a issue at all. A clone would here just be a safety net for the
> domain logic and shouldn't affect the way you deal/interact with the
> objects.
>
> So I personally don't see any issues with it and don't think we need
> some strict rules for it. But this is again just my point of view and
> would be glad to hear some other opinions.
Don't know if we need strict rules, but definitly we need some
guidance/help/documentation/explanation!
- blog_example uses clone()
- extbase_kickstarter creates it without clone() AFAIK
IMO that is a no go. The example creates it with clone(), the
kickstarter creates it without. None explains why and about the impacts
and that there might be other approaches.
Now, I am confused. ;( This will most likely cause trouble because none
knows when to take which approach and how to document.
It would be awesome if you could some up the findings from this thread
and we get some guidance/tips from "the makers of". ;)
For now I will avoid clone() and see how far I get. :->
Greets,
Peter
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?
--
Peter Niederlag
http://www.niekom.de * TYPO3 & EDV Dienstleistungen *
More information about the TYPO3-project-typo3v4mvc
mailing list