[TYPO3-mvc] Cloning properties in setter and getter methods of models (blog example)
Thomas "Thasmo" Deinhamer
thasmo at gmail.com
Fri Feb 11 23:13:48 CET 2011
Franz Koch wrote:
>
> no, not for all getters/setters - that would be a bad idea IMO. I'd
> probably only do it for getters/setters passing objectStorages if the
> model relies on the usage of special add/remove methods - but that's
> just my personal estimation - no recommendation. Until now I actually
> never passed cloned objects directly by setters/getters but after
> thinking about it might do so in future (for objectStorages and/or where
> appropriate).
Okay, then. But I'm asking myself - and you pointed me in that
direction - if those objects (and I mean all objects passed to
setters and returned by getters) should be cloned regardless of
any special usage inside the methods, just because DDD tells us
that we need to use e.g. a setter to explicitly add new objects,
rather than using an already returned object.
And another problem I see is, that if I'm going to use extensions
from TER, I'd like to rely on a specific behaviour/consistency when
using the models getters and setters.
It would be a pain in the a* if I'd need to research how to use
getters/setters for every model in every other extension, no?
Regards,
Thomas
More information about the TYPO3-project-typo3v4mvc
mailing list