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

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Fri Feb 11 15:48:42 CET 2011


Hi guys!

Some time ago (maybe still present), in the blog example,
properties in setter and getter methods were cloned like this:

public function setStocks(Tx_Extbase_Persistence_ObjectStorage $stocks) {
	$this->stocks = clone $stocks;
}

public function getStocks() {
	return clone $this->stocks;
}

What's the reason for this and is it better
to use it also in own extensions?

Thanks,
Thomas


More information about the TYPO3-project-typo3v4mvc mailing list