[TYPO3-mvc] delete all related objects
Franz Koch
typo3.RemoveForMessage at elements-net.de
Fri May 20 02:15:12 CEST 2011
Hey,
>> i've got a n:m relation with value objects called anhaenge.
>> Now i want to delete all related objects (anhaenge) from my object.
>>
>> How can i do this?
>
> Just annotate the embedded object property with "@cascade remove"
this will only remove the related objects if you delete the parent
object. If you only want to remove all "anhaenge" objects from the
parent object, simply replace the objectStorage holding the related
objects with a empty objectStorage.
$foo->setAnhaenge(new Tx_Extbase_Persistence_ObjectStorage());
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list