[TYPO3-mvc] Copy object and add to repository

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Apr 7 11:16:05 CEST 2011


Hey,

> Is there a comparable method for
> Tx_Extbase_Persistence_LazyObjectStorage and/or
> Tx_Extbase_Persistence_ObjectStorage?
>
> I didn't find something in the source.

Tx_Extbase_Persistence_LazyObjectStorage extends 
Tx_Extbase_Persistence_ObjectStorage, so you won't run into troubles 
with this when assigning it to a property expecting 
Tx_Extbase_Persistence_ObjectStorage.

But I think you're asking because the relations are not stored for your 
new object then. What you could do is this:

if ($propertyValue intstanceof Tx_Extbase_Persistence_LazyObjectStorage) {
	$propertyValue = new 
Tx_Extbase_Persistence_ObjectStorage()->addAll($propertyValue);
}

not tested, but should work. In general just create a new empty 
objectStorage and pass the lazy storage to the "addAll" method.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list