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

Sebastian Kurfürst sebastian at typo3.org
Mon Feb 14 07:15:33 CET 2011


Hey,

You should only clone if you have to return an ObjectStorage and expect
it to be modified afterwards. In order to make sure these changes to the
ObjectStorage are not persisted, you should clone it.

So, this is what you should do inside *Value Objects* (as VOs should not
change after creation); but inside entities, it's normally not needed to
clone the objects for the above reasons.

I'm not sure however if the blog example does this consistently ;-)

Greets,
Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list